Skip to:
Content

BuddyPress.org

Ticket #5436: 5436.03.patch

File 5436.03.patch, 4.6 KB (added by boonebgorges, 11 years ago)
  • bp-core/bp-core-loader.php

    diff --git bp-core/bp-core-loader.php bp-core/bp-core-loader.php
    index 7dd0f51..1748ff0 100644
    class BP_Core extends BP_Component { 
    261261function bp_setup_core() {
    262262        buddypress()->core = new BP_Core();
    263263}
    264 add_action( 'bp_setup_components', 'bp_setup_core', 2 );
     264add_action( 'bp_loaded', 'bp_setup_core', 0 );
  • bp-members/bp-members-loader.php

    diff --git bp-members/bp-members-loader.php bp-members/bp-members-loader.php
    index d88380b..b4de372 100644
    class BP_Members_Component extends BP_Component { 
    8080
    8181                /** Logged in user ****************************************************/
    8282
     83                // The core userdata of the user who is currently logged in.
     84                $bp->loggedin_user->userdata       = bp_core_get_core_userdata( bp_loggedin_user_id() );
     85
    8386                // Fetch the full name for the logged in user
    84                 $bp->loggedin_user->fullname       = bp_core_get_user_displayname( bp_loggedin_user_id() );
     87                $bp->loggedin_user->fullname       = $bp->loggedin_user->userdata->display_name;
    8588
    8689                // Hits the DB on single WP installs so get this separately
    8790                $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin( bp_loggedin_user_id() );
    class BP_Members_Component extends BP_Component { 
    8992                // The domain for the user currently logged in. eg: http://domain.com/members/andy
    9093                $bp->loggedin_user->domain         = bp_core_get_user_domain( bp_loggedin_user_id() );
    9194
    92                 // The core userdata of the user who is currently logged in.
    93                 $bp->loggedin_user->userdata       = bp_core_get_core_userdata( bp_loggedin_user_id() );
    94 
    9595                /** Displayed user ****************************************************/
    9696
    97                 // The domain for the user currently being displayed
    98                 $bp->displayed_user->domain   = bp_core_get_user_domain( bp_displayed_user_id() );
    99 
    10097                // The core userdata of the user who is currently being displayed
    10198                $bp->displayed_user->userdata = bp_core_get_core_userdata( bp_displayed_user_id() );
    10299
    103100                // Fetch the full name displayed user
    104                 $bp->displayed_user->fullname = bp_core_get_user_displayname( bp_displayed_user_id() );
     101                $bp->displayed_user->fullname = $bp->displayed_user->userdata->fullname;
     102
     103                // The domain for the user currently being displayed
     104                $bp->displayed_user->domain   = bp_core_get_user_domain( bp_displayed_user_id() );
    105105
    106106                /** Signup ***************************************************/
    107107                $bp->signup = new stdClass;
    class BP_Members_Component extends BP_Component { 
    117117                /** Default Profile Component *****************************************/
    118118
    119119                if ( !defined( 'BP_DEFAULT_COMPONENT' ) ) {
    120                         if ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) ) {
    121                                 $bp->default_component = bp_get_activity_slug();
     120                        if ( bp_is_active( 'activity' ) ) {
     121                                $bp->default_component = $bp->activity->id;
    122122                        } else {
    123                                 $bp->default_component = ( 'xprofile' === $bp->profile->id ) ? 'profile' : $bp->profile->id;
     123                                $bp->default_component = ( 'xprofile' == $bp->profile->id ) ? 'profile' : $bp->profile->id;
    124124                        }
    125 
    126125                } else {
    127126                        $bp->default_component = BP_DEFAULT_COMPONENT;
    128127                }
  • bp-xprofile/bp-xprofile-functions.php

    diff --git bp-xprofile/bp-xprofile-functions.php bp-xprofile/bp-xprofile-functions.php
    index cd116fd..41aaed3 100644
    function xprofile_update_field_position( $field_id, $position, $field_group_id ) 
    418418}
    419419
    420420/**
     421 * Replace the displayed and logged-in userss fullnames with the xprofile name, if required.
     422 *
     423 * The Members component uses the logged-in user's display_name to set the
     424 * value of buddypress()->loggedin_user->fullname. However, in cases where
     425 * profile sync is disabled, display_name may diverge from the xprofile
     426 * fullname field value, and the xprofile field should take precedence.
     427 *
     428 * Runs at bp_setup_globals:100 to ensure that all components have loaded their
     429 * globals before attempting any overrides.
     430 *
     431 * @since BuddyPress (2.0.0)
     432 */
     433function xprofile_override_user_fullnames() {
     434        // If sync is enabled, the two names will match. No need to continue.
     435        if ( ! bp_disable_profile_sync() ) {
     436                return;
     437        }
     438
     439        if ( bp_loggedin_user_id() ) {
     440                buddypress()->loggedin_user->fullname = bp_core_get_user_displayname( bp_loggedin_user_id() );
     441        }
     442
     443        if ( bp_displayed_user_id() ) {
     444                buddypress()->displayed_user->fullname = bp_core_get_user_displayname( bp_displayed_user_id() );
     445        }
     446}
     447add_action( 'bp_setup_globals', 'xprofile_override_user_fullnames', 100 );
     448
     449/**
    421450 * Setup the avatar upload directory for a user.
    422451 *
    423452 * @package BuddyPress Core