/**
 * Return the URL used for deleting a single notification.
 *
 * @since BuddyPress (2.1.0)
 *
 * @return string
 */
function bp_get_the_notification_delete_url()
{
    // URL to add nonce to
    if (bp_is_current_action('unread')) {
        $link = bp_get_notifications_unread_permalink();
    } elseif (bp_is_current_action('read')) {
        $link = bp_get_notifications_read_permalink();
    }
    // Get the ID
    $id = bp_get_the_notification_id();
    // Get the args to add to the URL
    $args = array('action' => 'delete', 'notification_id' => $id);
    // Add the args
    $url = add_query_arg($args, $link);
    // Add the nonce
    $url = wp_nonce_url($url, 'bp_notification_delete_' . $id);
    /**
     * Filters the URL used for deleting a single notification.
     *
     * @since BuddyPress (2.1.0)
     *
     * @param string $url URL used for deleting a single notification.
     */
    return apply_filters('bp_get_the_notification_delete_url', $url);
}
/**
 * Return the delete link for the current notification.
 *
 * @since BuddyPress (1.9.0)
 */
function bp_get_the_notification_delete_link()
{
    // URL to add nonce to
    if (bp_is_current_action('unread')) {
        $link = bp_get_notifications_unread_permalink();
    } elseif (bp_is_current_action('read')) {
        $link = bp_get_notifications_read_permalink();
    }
    // Get the URL with nonce, action, and id
    $url = wp_nonce_url(add_query_arg(array('action' => 'delete', 'notification_id' => bp_get_the_notification_id()), $link), 'bp_notification_delete_' . bp_get_the_notification_id());
    // Start the output buffer
    ob_start();
    ?>

		<a href="<?php 
    echo esc_url($url);
    ?>
" class="delete secondary confirm"><?php 
    _e('Delete', 'buddypress');
    ?>
</a>

		<?php 
    $retval = ob_get_clean();
    return apply_filters('bp_get_the_notification_delete_link', $retval);
}
/**
 * Return the URL used for deleting a single notification
 *
 * @since BuddyPress (2.1.0)
 *
 * @return string
 */
function bp_get_the_notification_delete_url()
{
    // URL to add nonce to
    if (bp_is_current_action('unread')) {
        $link = bp_get_notifications_unread_permalink();
    } elseif (bp_is_current_action('read')) {
        $link = bp_get_notifications_read_permalink();
    }
    // Get the ID
    $id = bp_get_the_notification_id();
    // Get the args to add to the URL
    $args = array('action' => 'delete', 'notification_id' => $id);
    // Add the args
    $url = add_query_arg($args, $link);
    // Add the nonce
    $url = wp_nonce_url($url, 'bp_notification_delete_' . $id);
    // Filter and return
    return apply_filters('bp_get_the_notification_delete_url', $url);
}
/**
 * Return the URL used for deleting a single notification.
 *
 * @since 2.1.0
 * @since 2.6.0 Added $user_id as a parameter.
 *
 * @param int $user_id The user ID.
 * @return string
 */
function bp_get_the_notification_delete_url($user_id = 0)
{
    // Set default user ID to use.
    $user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
    // URL to add nonce to.
    if (bp_is_current_action('unread')) {
        $link = bp_get_notifications_unread_permalink($user_id);
    } elseif (bp_is_current_action('read')) {
        $link = bp_get_notifications_read_permalink($user_id);
    }
    // Get the ID.
    $id = bp_get_the_notification_id();
    // Get the args to add to the URL.
    $args = array('action' => 'delete', 'notification_id' => $id);
    // Add the args.
    $url = add_query_arg($args, $link);
    // Add the nonce.
    $url = wp_nonce_url($url, 'bp_notification_delete_' . $id);
    /**
     * Filters the URL used for deleting a single notification.
     *
     * @since 2.1.0
     * @since 2.6.0 Added $user_id as a parameter.
     *
     * @param string $url     URL used for deleting a single notification.
     * @param int    $user_id The user ID.
     */
    return apply_filters('bp_get_the_notification_delete_url', $url, $user_id);
}