Skip to:
Content

BuddyPress.org

Ticket #6123: 6123.03.patch

File 6123.03.patch, 2.2 KB (added by imath, 5 years ago)
  • src/bp-core/bp-core-catchuri.php

    diff --git src/bp-core/bp-core-catchuri.php src/bp-core/bp-core-catchuri.php
    index a0dcb8a..4daa364 100644
    function bp_core_set_uri_globals() { 
    269269                                        return;
    270270                                }
    271271
    272                                 // If the displayed user is marked as a spammer, 404 (unless logged-
    273                                 // in user is a super admin)
    274                                 if ( bp_displayed_user_id() && bp_is_user_spammer( bp_displayed_user_id() ) ) {
    275                                         if ( bp_current_user_can( 'bp_moderate' ) ) {
     272                                // If the displayed user is marked as a spammer, the account is not active or user is deleted, 404
     273                                // (unless logged-in user is a super admin if the user is marked as spammer)
     274                                if ( bp_displayed_user_id() && bp_is_user_inactive( bp_displayed_user_id() ) ) {
     275
     276                                        // Only display spammer if the user is a super admin
     277                                        if ( bp_is_user_spammer( bp_displayed_user_id() ) && bp_current_user_can( 'bp_moderate' ) ) {
    276278                                                bp_core_add_message( __( 'This user has been marked as a spammer. Only site admins can view this profile.', 'buddypress' ), 'warning' );
    277279                                        } else {
    278280                                                bp_do_404();
  • src/bp-members/bp-members-loader.php

    diff --git src/bp-members/bp-members-loader.php src/bp-members/bp-members-loader.php
    index ecdf91e..0a8a68e 100644
    class BP_Members_Component extends BP_Component { 
    193193                                unset( $bp->canonical_stack['component'] );
    194194                        }
    195195
    196                         // if we're on a spammer's profile page, only users with the 'bp_moderate' cap
    197                         // can view subpages on the spammer's profile
    198                         //
    199                         // users without the cap trying to access a spammer's subnav page will get
    200                         // redirected to the root of the spammer's profile page.  this occurs by
    201                         // by removing the component in the canonical stack.
    202                         if ( bp_is_user_spammer( bp_displayed_user_id() ) && ! bp_current_user_can( 'bp_moderate' ) ) {
     196                        // if we're on a not active user profile page, redirect to the root of the user's profile page.
     197                        // this occurs by removing the component in the canonical stack.
     198                        if ( bp_is_user_inactive( bp_displayed_user_id() ) && ! bp_current_user_can( 'bp_moderate' ) ) {
    203199                                unset( $bp->canonical_stack['component'] );
    204200                        }
    205201                }