Skip to:
Content

BuddyPress.org

Changeset 7527


Ignore:
Timestamp:
11/08/2013 04:40:26 AM (11 years ago)
Author:
johnjamesjacoby
Message:

In Messages component, add sender_id to secondary_item_id in notifications. Will be used to include the username in notifications. See #5148.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-messages/bp-messages-functions.php

    r7462 r7527  
    117117
    118118        // Send screen notifications to the recipients
    119         foreach ( (array) $message->recipients as $recipient )
    120             bp_core_add_notification( $message->id, $recipient->user_id, 'messages', 'new_message' );
     119        foreach ( (array) $message->recipients as $recipient ) {
     120            bp_core_add_notification( $message->id, $recipient->user_id, 'messages', 'new_message', $message->sender_id );
     121        }
    121122
    122123        // Send email notifications to the recipients
     
    242243
    243244        if ( (int) $total_items > 1 ) {
    244             $text = sprintf( __('You have %d new messages', 'buddypress' ), (int) $total_items );
     245            $text   = sprintf( __('You have %d new messages', 'buddypress' ), (int) $total_items );
    245246            $filter = 'bp_messages_multiple_new_message_notification';
    246247        } else {
    247             $text = sprintf( __('You have %d new message', 'buddypress' ), (int) $total_items );
     248            if ( !empty( $secondary_item_id ) ) {
     249                $text = sprintf( __('You have %d new message from %s', 'buddypress' ), (int) $total_items, bp_core_get_user_displayname( $secondary_item_id ) );
     250            } else {
     251                $text = sprintf( __('You have %d new message',         'buddypress' ), (int) $total_items );
     252            }
    248253            $filter = 'bp_messages_single_new_message_notification';
    249254        }
Note: See TracChangeset for help on using the changeset viewer.