BP_Core_Notification::get_all_for_user( int $user_id, string $status = 'is_new' )
Fetches all the notifications in the database for a specific user.
Description Description
Parameters Parameters
- $user_id
-
(Required) User ID.
- $status
-
(Optional) 'is_new' or 'all'.
Default value: 'is_new'
Return Return
(array) Associative array
Source Source
File: bp-core/classes/class-bp-core-notification.php
public static function get_all_for_user( $user_id, $status = 'is_new' ) { global $wpdb; $bp = buddypress(); $is_new = ( 'is_new' === $status ) ? ' AND is_new = 1 ' : ''; return $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->core->table_name_notifications} WHERE user_id = %d {$is_new}", $user_id ) ); }