BP_Core_Notification::delete_from_user_by_type( int $user_id, string $component_name, string $component_action )
Deletes all the notifications sent by a specific user, by component and action.
Description
Parameters
- $user_id
-
(int) (Required) The ID of the user whose sent notifications we wish to delete.
- $component_name
-
(string) (Required) The name of the component the notification was sent from.
- $component_action
-
(string) (Required) The action of the component the notification was sent from.
Return
(mixed)
Source
File: bp-core/classes/class-bp-core-notification.php
public static function delete_from_user_by_type( $user_id, $component_name, $component_action ) { global $wpdb; $bp = buddypress(); return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE item_id = %d AND component_name = %s AND component_action = %s", $user_id, $component_name, $component_action ) ); }
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.