Changeset 4506 for trunk/bp-core/bp-core-catchuri.php
- Timestamp:
- 06/13/2011 09:54:52 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/bp-core-catchuri.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-catchuri.php
r4490 r4506 243 243 $bp->displayed_user->id = (int) bp_core_get_userid_from_nicename( urldecode( $bp_uri[$uri_offset + 1] ) ); 244 244 245 if ( empty( $bp->displayed_user->id ) ) { 246 // Prevent components from loading their templates 247 $bp->current_component = ''; 248 249 bp_do_404(); 250 return; 251 } 252 245 253 // Bump the offset 246 254 if ( isset( $bp_uri[$uri_offset + 2] ) ) { … … 352 360 */ 353 361 function bp_core_catch_no_access() { 354 global $bp, $ wp_query, $bp_unfiltered_uri, $bp_no_status_set;362 global $bp, $bp_no_status_set; 355 363 356 364 // If bp_core_redirect() and $bp_no_status_set is true, … … 359 367 return false; 360 368 361 // If the displayed user was marked as a spammer and the logged-in user is not a super admin, redirect369 // If the displayed user was marked as a spammer and the logged-in user is not a super admin, 404. 362 370 if ( isset( $bp->displayed_user->id ) && bp_core_is_user_spammer( $bp->displayed_user->id ) ) { 363 if ( !is_super_admin() ) 364 bp_core_redirect( $bp->root_domain ); 365 else 371 if ( !$bp->loggedin_user->is_super_admin ) { 372 bp_do_404(); 373 return; 374 375 } else { 366 376 bp_core_add_message( __( 'This user has been marked as a spammer. Only site admins can view this profile.', 'buddypress' ), 'error' ); 367 } 368 369 // If BP_ENABLE_ROOT_PROFILES is not defined and the displayed user does not exist, redirect 370 if ( !$bp->displayed_user->id && isset( $bp_unfiltered_uri[0] ) && $bp_unfiltered_uri[0] == $bp->members->slug && isset( $bp_unfiltered_uri[1] ) ) 371 bp_core_redirect( $bp->root_domain ); 372 373 // Access control! 377 } 378 } 379 374 380 if ( !isset( $wp_query->queried_object ) && !bp_is_blog_page() ) { 375 if ( is_user_logged_in() ) { 376 bp_core_no_access( array( 'redirect' => false, 'message' => __( 'You do not have access to that page', 'buddypress' ) ) ); 377 } else { 378 bp_core_no_access(); 379 } 381 bp_do_404(); 380 382 } 381 383 } … … 402 404 $r = wp_parse_args( $args, $defaults ); 403 405 extract( $r, EXTR_SKIP ); 404 405 // Group filtering406 // When a user doesn't have access to a group's activity / secondary page, redirect to group's homepage407 if ( !$redirect ) {408 if ( bp_is_active( 'groups' ) && bp_is_current_component( 'groups' ) ) {409 $root = bp_get_group_permalink( $bp->groups->current_group );410 $message = false;411 }412 }413 406 414 407 // Apply filters to these variables
Note: See TracChangeset
for help on using the changeset viewer.