Skip to:
Content

BuddyPress.org

Changeset 5234


Ignore:
Timestamp:
10/11/2011 02:04:59 PM (8 years ago)
Author:
boonebgorges
Message:

Moves bp_core_is_user_spammer() 404 check from bp_core_catch_no_access() to bp_core_set_uri_globals(), to ensure that it's run in time to 404 for non-super-admins. Fixes #3666

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.5/bp-core/bp-core-catchuri.php

    r5156 r5234  
    251251                }
    252252
     253                // If the displayed user is marked as a spammer, 404 (unless logged-
     254                // in user is a super admin)
     255                if ( !empty( $bp->displayed_user->id ) && bp_core_is_user_spammer( $bp->displayed_user->id ) ) {
     256                    if ( is_super_admin() ) {
     257                        bp_core_add_message( __( 'This user has been marked as a spammer. Only site admins can view this profile.', 'buddypress' ), 'error' );
     258                    } else {
     259                        bp_do_404();
     260                        return;
     261                    }
     262                }
     263
    253264                // Bump the offset
    254265                if ( isset( $bp_uri[$uri_offset + 2] ) ) {
     
    368379    if ( $bp_no_status_set )
    369380        return false;
    370 
    371     // If the displayed user was marked as a spammer and the logged-in user is not a super admin, 404.
    372     if ( isset( $bp->displayed_user->id ) && bp_core_is_user_spammer( $bp->displayed_user->id ) ) {
    373         if ( !$bp->loggedin_user->is_super_admin ) {
    374             bp_do_404();
    375             return;
    376 
    377         } else {
    378             bp_core_add_message( __( 'This user has been marked as a spammer. Only site admins can view this profile.', 'buddypress' ), 'error' );
    379         }
    380     }
    381381
    382382    if ( !isset( $wp_query->queried_object ) && !bp_is_blog_page() ) {
Note: See TracChangeset for help on using the changeset viewer.