bp_get_the_notification_action_links

Return the action links for the current notification.

Description

(string) bp_get_the_notification_action_links( (string) $args = '' ); 

Returns (string)

HTML links for actions to take on single notifications.

Parameters (1)

0. $args — Optional. (string) => ''
The args.

Options

  • before (string) => ''

    HTML before the links.

  • after (string) => ''

    HTML after the links.

  • sep (string) => ''

    HTML between the links.

  • links (array) => null

    Array of links to implode by sep..

array(

    /**
     * HTML before the links.
     *
     * @type string
     * @default ''
     */
    'before' => '',

    /**
     * HTML after the links.
     *
     * @type string
     * @default ''
     */
    'after' => '',

    /**
     * HTML between the links.
     *
     * @type string
     * @default ''
     */
    'sep' => '',

    /**
     * Array of links to implode by 'sep'.
     *
     * @type array
     * @default null
     */
    'links' => null
);        


Usage

  1. if ( !function_exists( 'bp_get_the_notification_action_links' ) ) { 
  2. require_once '/bp-notifications/bp-notifications-template.php'; 
  3.  
  4. // The args. 
  5. $args = array( 
  6. 'before' => '', 
  7. 'after' => '', 
  8. 'sep' => '', 
  9. 'links' => null 
  10. ); 
  11.  
  12. // NOTICE! Understand what this does before running. 
  13. $result = bp_get_the_notification_action_links($args); 
  14.  

Defined (1)

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

/bp-notifications/bp-notifications-template.php  
  1. function bp_get_the_notification_action_links( $args = '' ) { 
  2. // Set default user ID to use. 
  3. $user_id = isset( $args['user_id'] ) ? $args['user_id'] : bp_displayed_user_id(); 
  4.  
  5. // Parse. 
  6. $r = wp_parse_args( $args, array( 
  7. 'before' => '',  
  8. 'after' => '',  
  9. 'sep' => ' | ',  
  10. 'links' => array( 
  11. bp_get_the_notification_mark_link( $user_id ),  
  12. bp_get_the_notification_delete_link( $user_id ) 
  13. ) ); 
  14.  
  15. // Build the links. 
  16. $retval = $r['before'] . implode( $r['links'], $r['sep'] ) . $r['after']; 
  17.  
  18. /** 
  19. * Filters the action links for the current notification. 
  20. * @since 1.9.0 
  21. * @since 2.6.0 Added the `$r` parameter. 
  22. * @param string $retval HTML links for actions to take on single notifications. 
  23. * @param array $r Array of parsed arguments. 
  24. */ 
  25. return apply_filters( 'bp_get_the_notification_action_links', $retval, $r );