bprwg_notifications

The BP Registration Options bprwg notifications function.

Description

bprwg_notifications( $action, $item_id, $secondary_item_id, (number) $total_items, (string) $format, (string) $component_action_name, (string) $component_name ); 

Parameters (7)

0. $action
The action.
1. $item_id
The item id.
2. $secondary_item_id
The secondary item id.
3. $total_items (number)
The total items.
4. $format (string)
The format.
5. $component_action_name (string)
The component action name.
6. $component_name (string)
The component name.

Usage

  1. if ( !function_exists( 'bprwg_notifications' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-registration-options/includes/core.php'; 
  3.  
  4. // The action. 
  5. $action = null; 
  6.  
  7. // The item id. 
  8. $item_id = null; 
  9.  
  10. // The secondary item id. 
  11. $secondary_item_id = null; 
  12.  
  13. // The total items. 
  14. $total_items = null; 
  15.  
  16. // The format. 
  17. $format = ''; 
  18.  
  19. // The component action name. 
  20. $component_action_name = ''; 
  21.  
  22. // The component name. 
  23. $component_name = ''; 
  24.  
  25. // NOTICE! Understand what this does before running. 
  26. $result = bprwg_notifications($action, $item_id, $secondary_item_id, $total_items, $format, $component_action_name, $component_name); 
  27.  

Defined (1)

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

/includes/core.php  
  1. function bprwg_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string', $component_action_name, $component_name ) { 
  2.  
  3. if ( bp_registration_options === $component_action_name ) { 
  4.  
  5. /** 
  6. * Filters the text used for the notification generated by BuddyPress Registration Options. 
  7. * @since 4.3.0 
  8. * @param string $value Notification text. 
  9. */ 
  10. $text = apply_filters( 'bprwg_notification_text', __( 'You have a new pending user to moderate.', 'bp-registration-options' ) ); 
  11. $link = admin_url( 'admin.php?page=bp_registration_options_member_requests' ); 
  12.  
  13. $result = array( 
  14. 'text' => $text,  
  15. 'link' => $link 
  16. ); 
  17.  
  18. // WordPress Toolbar 
  19. if ( 'string' === $format ) { 
  20. $result = sprintf( '<a href="%s">%s</a>', $link, $text ); 
  21.  
  22. return $result; 
  23.  
  24. return $action;