BP_Core_Notification::delete_all_by_type( string $item_id, string $component_name, string $component_action, string $secondary_item_id )
Deletes all the notifications for all users by item id, and optional secondary item id, and component name and action.
Description
Parameters
- $item_id
-
(Required) The item id that they notifications are to be for.
- $component_name
-
(Required) The component that the notifications are to be from.
- $component_action
-
(Required) The action that the notifications are to be from.
- $secondary_item_id
-
(Optional) secondary item id that the notifications are to have.
Return
(mixed)
Source
File: bp-core/classes/class-bp-core-notification.php
public static function delete_all_by_type( $item_id, $component_name, $component_action, $secondary_item_id ) { global $wpdb; if ( $component_action ) $component_action_sql = $wpdb->prepare( "AND component_action = %s", $component_action ); else $component_action_sql = ''; if ( $secondary_item_id ) $secondary_item_sql = $wpdb->prepare( "AND secondary_item_id = %d", $secondary_item_id ); else $secondary_item_sql = ''; $bp = buddypress(); return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE item_id = %d AND component_name = %s {$component_action_sql} {$secondary_item_sql}", $item_id, $component_name ) ); }
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.