Skip to:
Content

bbPress.org

Changeset 7183


Ignore:
Timestamp:
01/04/2021 03:32:20 AM (11 months ago)
Author:
johnjamesjacoby
Message:

BuddyPress: add topic ID to bbp_new_reply notification type.

This commit adds more context to otherwise vague topic reply notifications, and also more accurately marks notifications as read when clicking on the adminbar menu to view them.

In trunk for 2.7.0. See #3341.

Props konnektiv.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/extend/buddypress/notifications.php

    r7108 r7183  
    6363
    6464    // Bail if not the notification action we are looking for
    65     if ( 'bbp_new_reply' !== $component_action_name ) {
     65    if ( 0 !== strpos( $component_action_name, 'bbp_new_reply' ) ) {
    6666        return $content;
    6767    }
     
    8787    if ( $action_item_count > 1 ) {
    8888        $filter = 'bbp_multiple_new_subscription_notification';
    89         $text   = sprintf( esc_html__( 'You have %d new replies', 'bbpress' ), $action_item_count );
     89        $text   = sprintf( esc_html__( 'You have %1$d new replies to %2$s', 'bbpress' ), $action_item_count, $topic_title );
    9090
    9191    // Single
     
    149149        'item_id'          => $reply_id,
    150150        'component_name'   => bbp_get_component_name(),
    151         'component_action' => 'bbp_new_reply',
     151        'component_action' => 'bbp_new_reply_' . $topic_id,
    152152        'date_notified'    => get_post( $reply_id )->post_date,
    153153    );
     
    212212
    213213        // Attempt to clear notifications for this topic
    214         $marked    = bp_notifications_mark_notifications_by_item_id( $user_id, $topic_id, $component, 'bbp_new_reply' );
     214        $marked    = bp_notifications_mark_notifications_by_type( $user_id, $component, 'bbp_new_reply_' . $topic_id );
    215215
    216216        // Get all reply IDs for the topic
Note: See TracChangeset for help on using the changeset viewer.