Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/06/2017 05:46:21 PM (7 years ago)
Author:
dcavins
Message:

Show displayed user's messages on messages screens.

When a site administrator visits another user’s messages, she is shown
her own messages because the display logic for messages refers to the
logged-in user rather than the displayed user. This changeset updates
the logic to allow the site admin to view and interact with another
user’s messages.

Fixes #7096.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/bp-messages-cache.php

    r10417 r11578  
    7575 * @param int|array $thread_ids If single thread, the thread ID.
    7676 *                              Otherwise, an array of thread IDs.
     77 * @param int       $user_id    ID of the user that the threads were deleted for.
    7778 */
    78 function bp_messages_clear_cache_on_message_delete( $thread_ids ) {
     79function bp_messages_clear_cache_on_message_delete( $thread_ids, $user_id ) {
    7980    // Delete thread and thread recipient cache.
    8081    foreach( (array) $thread_ids as $thread_id ) {
     
    8485
    8586    // Delete unread count for logged-in user.
    86     wp_cache_delete( bp_loggedin_user_id(), 'bp_messages_unread_count' );
     87    wp_cache_delete( $user_id, 'bp_messages_unread_count' );
    8788}
    88 add_action( 'messages_delete_thread', 'bp_messages_clear_cache_on_message_delete' );
     89add_action( 'messages_delete_thread', 'bp_messages_clear_cache_on_message_delete', 10, 2 );
    8990
    9091/**
Note: See TracChangeset for help on using the changeset viewer.