bp_get_the_notification_action_links( array|string $args = '' )

Return the action links for the current notification.

Description

Parameters

$args

(array|string) (Optional)

  • 'before'
    (string) HTML before the links.
  • 'after'
    (string) HTML after the links.
  • 'sep'
    (string) HTML between the links.
  • 'links'
    (array) Array of links to implode by 'sep'.
  • 'user_id'
    (int) User ID to fetch action links for. Defaults to displayed user ID.

Default value: ''

Return

(string) HTML links for actions to take on single notifications.

Source

File: 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 BuddyPress 1.9.0
		 * @since BuddyPress 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 );
	}

Changelog

Changelog
Version Description
BuddyPress 2.6.0 Added $user_id as a parameter to $args. BuddyPress 2.6.0 Added $user_id as a parameter to $args.
BuddyPress 1.9.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.