Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions notifications-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ public function clear_notifications() {

global $bp, $wpdb;

$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE user_id = %d ", $user_id ) );
if($_REQUEST['clear-all'] == 'true')
$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE user_id = %d ", $user_id ) );
else
$wpdb->query( $wpdb->prepare( "UPDATE {$bp->core->table_name_notifications} SET is_new=0 WHERE user_id = %d ", $user_id ) );

echo "1";
exit( 0 );
Expand All @@ -94,9 +97,8 @@ public function clear_notifications() {
*/
public function load_js() {
$url = plugin_dir_url( __FILE__ );
wp_enqueue_script( 'bp-notification-widget-clear-js', $url . 'notification.js', array( 'jquery' ) );
wp_enqueue_script( 'bp-notification-widget-clear-js', $url . 'notification.js', array( 'jquery' ), '1.2.3', true); // load in footer
}
}

new BuddyDev_BP_Notifications_Widget_Helper();