Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/08/2011 01:14:31 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Use bp_displayed_user_id() rather than reference the $bp->displayed_user->id global var directly. First step at consolidating user ID checks to use WP_User class later. See #3738.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-catchuri.php

    r5238 r5301  
    238238
    239239                // Switch the displayed_user based on compatbility mode
    240                 if ( bp_is_username_compatibility_mode() )
     240                if ( bp_is_username_compatibility_mode() ) {
    241241                    $bp->displayed_user->id = (int) bp_core_get_userid( urldecode( $bp_uri[$uri_offset + 1] ) );
    242                 else
     242                } else {
    243243                    $bp->displayed_user->id = (int) bp_core_get_userid_from_nicename( urldecode( $bp_uri[$uri_offset + 1] ) );
    244 
    245                 if ( empty( $bp->displayed_user->id ) ) {
     244                }
     245
     246                if ( !bp_displayed_user_id() ) {
     247
    246248                    // Prevent components from loading their templates
    247249                    $bp->current_component = '';
     
    253255                // If the displayed user is marked as a spammer, 404 (unless logged-
    254256                // in user is a super admin)
    255                 if ( !empty( $bp->displayed_user->id ) && bp_core_is_user_spammer( $bp->displayed_user->id ) ) {
     257                if ( bp_displayed_user_id() && bp_core_is_user_spammer( bp_displayed_user_id() ) ) {
    256258                    if ( is_super_admin() ) {
    257259                        bp_core_add_message( __( 'This user has been marked as a spammer. Only site admins can view this profile.', 'buddypress' ), 'error' );
Note: See TracChangeset for help on using the changeset viewer.