Skip to:
Content

BuddyPress.org

Ticket #6123: 6123.02.diff

File 6123.02.diff, 2.2 KB (added by imath, 10 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..c76b253 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' ) ) {
    276                                                 bp_core_add_message( __( 'This user has been marked as a spammer. Only site admins can view this profile.', 'buddypress' ), 'warning' );
    277                                         } else {
     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() ) {
     275
     276                                        // Do not display a "not activated" signup or deleted user as a member
     277                                        if ( bp_is_user_deleted( bp_displayed_user_id() ) ) {
    278278                                                bp_do_404();
    279279                                                return;
    280280                                        }
     281
     282                                        // Only display spammer if the user is a super admin
     283                                        if ( bp_is_user_spammer( bp_displayed_user_id() ) ) {
     284                                                if ( bp_current_user_can( 'bp_moderate' ) ) {
     285                                                        bp_core_add_message( __( 'This user has been marked as a spammer. Only site admins can view this profile.', 'buddypress' ), 'warning' );
     286                                                } else {
     287                                                        bp_do_404();
     288                                                        return;
     289                                                }
     290                                        }
    281291                                }
    282292
    283293                                // Bump the offset
  • 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..41cb432 100644
    class BP_Members_Component extends BP_Component { 
    199199                        // users without the cap trying to access a spammer's subnav page will get
    200200                        // redirected to the root of the spammer's profile page.  this occurs by
    201201                        // by removing the component in the canonical stack.
    202                         if ( bp_is_user_spammer( bp_displayed_user_id() ) && ! bp_current_user_can( 'bp_moderate' ) ) {
     202                        if ( ( bp_is_user_spammer( bp_displayed_user_id() ) && ! bp_current_user_can( 'bp_moderate' ) ) || bp_is_user_deleted( bp_displayed_user_id() ) ) {
    203203                                unset( $bp->canonical_stack['component'] );
    204204                        }
    205205                }