Skip to:
Content

BuddyPress.org

Changeset 11577


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

Messages: Show Compose and Notices screens only on "my profile."

When a site administrator visits another user’s messages, she should
not see the “Notices” or “Compose” navigation items or be able to visit
those screens. These should only be available when bp_is_my_profile()
is true.

See #7096.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/classes/class-bp-messages-component.php

    r11360 r11577  
    205205                );
    206206
    207                 $sub_nav[] = array(
    208                         'name'            => __( 'Compose', 'buddypress' ),
    209                         'slug'            => 'compose',
    210                         'parent_url'      => $messages_link,
    211                         'parent_slug'     => $slug,
    212                         'screen_function' => 'messages_screen_compose',
    213                         'position'        => 30,
    214                         'user_has_access' => $access
    215                 );
    216 
    217                 if ( bp_current_user_can( 'bp_moderate' ) ) {
     207                // Show certain screens only if the current user is the displayed user.
     208                if ( bp_is_my_profile() ) {
     209
     210                        // Show "Compose" on the logged-in user's profile only.
    218211                        $sub_nav[] = array(
    219                                 'name'            => __( 'Notices', 'buddypress' ),
    220                                 'slug'            => 'notices',
     212                                'name'            => __( 'Compose', 'buddypress' ),
     213                                'slug'            => 'compose',
    221214                                'parent_url'      => $messages_link,
    222215                                'parent_slug'     => $slug,
    223                                 'screen_function' => 'messages_screen_notices',
    224                                 'position'        => 90,
    225                                 'user_has_access' => true
    226                         );
     216                                'screen_function' => 'messages_screen_compose',
     217                                'position'        => 30,
     218                                'user_has_access' => $access
     219                        );
     220
     221                        /*
     222                         * Show "Notices" on the logged-in user's profile only
     223                         * and then only if the user can create notices.
     224                         */
     225                        if ( bp_current_user_can( 'bp_moderate' ) ) {
     226                                $sub_nav[] = array(
     227                                        'name'            => __( 'Notices', 'buddypress' ),
     228                                        'slug'            => 'notices',
     229                                        'parent_url'      => $messages_link,
     230                                        'parent_slug'     => $slug,
     231                                        'screen_function' => 'messages_screen_notices',
     232                                        'position'        => 90,
     233                                        'user_has_access' => true
     234                                );
     235                        }
    227236                }
    228237
Note: See TracChangeset for help on using the changeset viewer.