BP_Notifications_Notification::check_access( int $user_id, int $notification_id )
Check that a specific notification is for a specific user.
Description
Parameters
- $user_id
-
(Required) ID of the user being checked.
- $notification_id
-
(Required) ID of the notification being checked.
Return
(bool) True if the notification belongs to the user, otherwise false.
Source
File: bp-notifications/classes/class-bp-notifications-notification.php
public static function check_access( $user_id, $notification_id ) { global $wpdb; $bp = buddypress(); return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->core->table_name_notifications} WHERE id = %d AND user_id = %d", $notification_id, $user_id ) ); }
Changelog
Version | Description |
---|---|
BuddyPress 1.9.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.