BP_Notifications_Notification::check_access( int $user_id, int $notification_id )

Check that a specific notification is for a specific user.


Description Description


Parameters Parameters

$user_id

(Required) ID of the user being checked.

$notification_id

(Required) ID of the notification being checked.


Top ↑

Return Return

(bool) True if the notification belongs to the user, otherwise false.


Top ↑

Source 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 ) );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.9.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.