Skip to:
Content

BuddyPress.org

Changeset 7456


Ignore:
Timestamp:
10/22/2013 08:56:04 PM (11 years ago)
Author:
r-a-y
Message:

Fix trailing 'members' slug when non-admins view a spammer's profile.

If we're on a spammer's profile page, only users with the 'bp_moderate'
cap can view subpages on the spammer's profile.

Users without the cap trying to access a spammer's subnav page should be
redirected to the root of the spammer's profile page.

This commit does this by removing the component in the canonical stack
when a user without the 'bp_moderate' cap is on a spammer's profile page.

Fixes #5207.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-members/bp-members-loader.php

    r7454 r7456  
    138138                unset( $bp->canonical_stack['component'] );
    139139            }
     140
     141            // if we're on a spammer's profile page, only users with the 'bp_moderate' cap
     142            // can view subpages on the spammer's profile
     143            //
     144            // users without the cap trying to access a spammer's subnav page will get
     145            // redirected to the root of the spammer's profile page.  this occurs by
     146            // by removing the component in the canonical stack.
     147            if ( bp_is_user_spammer( bp_displayed_user_id() ) && ! bp_current_user_can( 'bp_moderate' ) ) {
     148                unset( $bp->canonical_stack['component'] );
     149            }
    140150        }
    141151    }
Note: See TracChangeset for help on using the changeset viewer.