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 );
…
- before (string) =>
Usage
if ( !function_exists( 'bp_get_the_notification_action_links' ) ) { require_once ABSPATH . PLUGINDIR . 'buddypress/bp-notifications/bp-notifications-template.php'; } // The args. $args = array( 'before' => '', 'after' => '', 'sep' => '', 'links' => null ); // NOTICE! Understand what this does before running. $result = bp_get_the_notification_action_links($args);
Defined (1)
The function is defined in the following location(s).
- /bp-notifications/bp-notifications-template.php
- function bp_get_the_notification_action_links( $args = '' ) {
- // Set default user ID to use.
- $user_id = isset( $args['user_id'] ) ? $args['user_id'] : bp_displayed_user_id();
- // Parse.
- $r = wp_parse_args( $args, array(
- 'before' => '',
- 'after' => '',
- 'sep' => ' | ',
- 'links' => array(
- bp_get_the_notification_mark_link( $user_id ),
- bp_get_the_notification_delete_link( $user_id )
- )
- ) );
- // Build the links.
- $retval = $r['before'] . implode( $r['links'], $r['sep'] ) . $r['after'];
- /**
- * Filters the action links for the current notification.
- *
- * @since 1.9.0
- * @since 2.6.0 Added the `$r` parameter.
- *
- * @param string $retval HTML links for actions to take on single notifications.
- * @param array $r Array of parsed arguments.
- */
- return apply_filters( 'bp_get_the_notification_action_links', $retval, $r );
- }