bp_get_the_notification_mark_unread_url( int $user_id )

Return the URL used for marking a single notification as unread.

Description

Parameters

$user_id

(Required) The user ID.

Return

(string)

Source

File: bp-notifications/bp-notifications-template.php

689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
function bp_get_the_notification_mark_unread_url( $user_id = 0 ) {
 
    // Get the notification ID.
    $id   = bp_get_the_notification_id();
 
    // Get the args to add to the URL.
    $args = array(
        'action'          => 'unread',
        'notification_id' => $id
    );
 
    // Set default user ID to use.
    $user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
 
    // Add the args to the URL.
    $url = add_query_arg( $args, bp_get_notifications_read_permalink( $user_id ) );
 
    // Add the nonce.
    $url = wp_nonce_url( $url, 'bp_notification_mark_unread_' . $id );
 
    /**
     * Filters the URL used for marking a single notification as unread.
     *
     * @since BuddyPress 2.1.0
     * @since BuddyPress 2.6.0 Added $user_id as a parameter.
     *
     * @param string $url     URL to use for marking the single notification as unread.
     * @param int    $user_id The user ID.
     */
    return apply_filters( 'bp_get_the_notification_mark_unread_url', $url, $user_id );
}

Changelog

Changelog
Version Description
BuddyPress 2.6.0 Added $user_id as a parameter. BuddyPress 2.6.0 Added $user_id as a parameter.
BuddyPress 2.1.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.