bp_gifts_format_notifications

The Buddypress Gifts Latest 2014 bp gifts format notifications function.

Description

bp_gifts_format_notifications( $action, $item_id, $secondary_item_id, (number) $total_items ); 

Parameters (4)

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.

Usage

  1. if ( !function_exists( 'bp_gifts_format_notifications' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-gifts-latest-2014/includes/bp-gifts-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. // NOTICE! Understand what this does before running. 
  17. $result = bp_gifts_format_notifications($action, $item_id, $secondary_item_id, $total_items); 
  18.  

Defined (1)

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

/includes/bp-gifts-core.php  
  1. function bp_gifts_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) { 
  2.  
  3. global $bp; 
  4.  
  5. switch ( $action ) { 
  6.  
  7. case 'new_gifts': 
  8.  
  9.  
  10.  
  11. if ( (int)$total_items > 1 ) { 
  12.  
  13. return apply_filters( 'bp_gifts_multiple_newgifts_notifications', '<a href="' . $bp->loggedin_user->domain . $bp->gifts->slug . '/" title="' . __( 'Multiple gifts', 'bp-gifts' ) . '">' . sprintf( __( '%d new gifts, multi-gifts!', 'bp-gifts' ), (int)$total_items ) . '</a>', $total_items ); 
  14.  
  15. } else { 
  16.  
  17. $user_fullname = bp_core_get_user_displayname( $item_id, false ); 
  18.  
  19. $user_url = bp_core_get_userlink( $item_id, true ); 
  20.  
  21. return apply_filters( 'bp_gifts_single_newgifts_notifications', '<a href="' . 'gifts' . '?new" title="' . $user_fullname .'\'s profile">' . sprintf( __( '%s sent you a high-five!', 'bp-gifts' ), $user_fullname ) . '</a>', $user_fullname ); 
  22.  
  23.  
  24.  
  25.  
  26. break; 
  27.  
  28.  
  29.  
  30.  
  31. do_action( 'bp_gifts_format_notifications', $action, $item_id, $secondary_item_id, $total_items ); 
  32.  
  33.  
  34.  
  35. return false; 
  36.