bp_get_the_notification_description()

Get full-text description for a specific notification.

Description

Return

(string)

Source

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

506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
function bp_get_the_notification_description() {
    $bp           = buddypress();
    $notification = $bp->notifications->query_loop->notification;
 
    // Callback function exists.
    if ( isset( $bp->{ $notification->component_name }->notification_callback ) && is_callable( $bp->{ $notification->component_name }->notification_callback ) ) {
        $description = call_user_func( $bp->{ $notification->component_name }->notification_callback, $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1, 'string', $notification->id );
 
    // @deprecated format_notification_function - 1.5
    } elseif ( isset( $bp->{ $notification->component_name }->format_notification_function ) && function_exists( $bp->{ $notification->component_name }->format_notification_function ) ) {
        $description = call_user_func( $bp->{ $notification->component_name }->format_notification_function, $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1 );
 
    // Allow non BuddyPress components to hook in.
    } else {
 
        /** This filter is documented in bp-notifications/bp-notifications-functions.php */
        $description = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', array( $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1, 'string', $notification->component_action, $notification->component_name, $notification->id ) );
    }
 
    /**
     * Filters the full-text description for a specific notification.
     *
     * @since BuddyPress 1.9.0
     * @since BuddyPress 2.3.0 Added the `$notification` parameter.
     *
     * @param string $description  Full-text description for a specific notification.
     * @param object $notification Notification object.
     */
    return apply_filters( 'bp_get_the_notification_description', $description, $notification );
}

Changelog

Changelog
Version Description
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.