Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/13/2017 07:11:00 PM (8 years ago)
Author:
boonebgorges
Message:

Restore default behavior of message link generating functions.

Prior to [11578], functions for generating links in the context of
messages (Mark Read, Delete, etc) were generated relative to the
logged-in user. This made it impossible for an administrator to
manage another user's messages. [11578] changed the default behavior
of these functions to reference the displayed user. But this change
breaks backward compatibility for functions expecting the prior
behavior, including BP's own message notification format functions.

We work around the limitation by introducing $user_id parameters
to the functions in question. $user_id defaults to the logged-in
user (for backward compatibilty), and the bp-legacy template passes
in the displayed user ID as appropriate.

Fixes #7096.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php

    r11591 r11644  
    116116
    117117                        <td class="thread-info">
    118                             <p><a href="<?php bp_message_thread_view_link(); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( "View Message", 'buddypress' ); ?>" aria-label="<?php esc_attr_e( "View Message", 'buddypress' ); ?>"><?php bp_message_thread_subject(); ?></a></p>
     118                            <p><a href="<?php bp_message_thread_view_link( bp_get_message_thread_id(), bp_displayed_user_id() ); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( "View Message", 'buddypress' ); ?>" aria-label="<?php esc_attr_e( "View Message", 'buddypress' ); ?>"><?php bp_message_thread_subject(); ?></a></p>
    119119                            <p class="thread-excerpt"><?php bp_message_thread_excerpt(); ?></p>
    120120                        </td>
     
    140140                        <td class="thread-options">
    141141                            <?php if ( bp_message_thread_has_unread() ) : ?>
    142                                 <a class="read" href="<?php bp_the_message_thread_mark_read_url();?>"><?php _e( 'Read', 'buddypress' ); ?></a>
     142                                <a class="read" href="<?php bp_the_message_thread_mark_read_url( bp_displayed_user_id() );?>"><?php _e( 'Read', 'buddypress' ); ?></a>
    143143                            <?php else : ?>
    144                                 <a class="unread" href="<?php bp_the_message_thread_mark_unread_url();?>"><?php _e( 'Unread', 'buddypress' ); ?></a>
     144                                <a class="unread" href="<?php bp_the_message_thread_mark_unread_url( bp_displayed_user_id() );?>"><?php _e( 'Unread', 'buddypress' ); ?></a>
    145145                            <?php endif; ?>
    146146                             |
    147                             <a class="delete" href="<?php bp_message_thread_delete_link(); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a>
     147                            <a class="delete" href="<?php bp_message_thread_delete_link( bp_displayed_user_id() ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a>
    148148
    149149                            <?php
Note: See TracChangeset for help on using the changeset viewer.