bp_core_delete_notifications_by_type

Delete notifications for a user by type.

Description

(boolean) bp_core_delete_notifications_by_type( (int) $user_id, (string) $component_name, (string) $component_action ); 

Used when clearing out notifications for a specific component when the user has visited that component.

Returns (boolean)

True on success, false on failure.

Parameters (3)

0. $user_id (int)
The user id.
1. $component_name (string)
The component name.
2. $component_action (string)
The component action.

Usage

  1. if ( !function_exists( 'bp_core_delete_notifications_by_type' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/deprecated/1.9.php'; 
  3.  
  4. // The user id. 
  5. $user_id = -1; 
  6.  
  7. // The component name. 
  8. $component_name = ''; 
  9.  
  10. // The component action. 
  11. $component_action = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bp_core_delete_notifications_by_type($user_id, $component_name, $component_action); 
  15.  

Defined (1)

The function is defined in the following location(s).

/bp-core/deprecated/1.9.php  
  1. function bp_core_delete_notifications_by_type( $user_id, $component_name, $component_action ) { 
  2.  
  3. // Bail if notifications is not active 
  4. if ( ! bp_is_active( 'notifications' ) ) { 
  5. return false; 
  6.  
  7. // Trigger the deprecated function notice 
  8. _deprecated_function( __FUNCTION__, '1.9', 'bp_notifications_delete_notifications_by_type()' ); 
  9.  
  10. return bp_notifications_delete_notifications_by_type( $user_id, $component_name, $component_action );