Skip to:
Content

BuddyPress.org

Changeset 4281


Ignore:
Timestamp:
04/24/2011 03:28:18 PM (13 years ago)
Author:
djpaul
Message:

Fix handling of certain subnav URLs in core, xprofile, friends, members, activity, settings, blogs and message components. See #3176

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-loader.php

    r4211 r4281  
    9090        global $bp;
    9191
     92        // Stop if there is no user displayed
     93        if ( empty( $bp->displayed_user->id ) )
     94            return;
     95
     96        // Determine user to use
     97        if ( !empty( $bp->displayed_user->domain ) )
     98            $user_domain = $bp->displayed_user->domain;
     99        else
     100            return;
     101           
    92102        // Add 'Activity' to the main navigation
    93103        $main_nav = array(
     
    99109            'item_css_id'         => $this->id
    100110        );
    101 
    102         // Stop if there is no user displayed or logged in
    103         if ( !is_user_logged_in() && !isset( $bp->displayed_user->id ) )
    104             return;
    105 
    106         // Determine user to use
    107         if ( isset( $bp->displayed_user->domain ) )
    108             $user_domain = $bp->displayed_user->domain;
    109         elseif ( isset( $bp->loggedin_user->domain ) )
    110             $user_domain = $bp->loggedin_user->domain;
    111         else
    112             return;
    113111
    114112        // User link
  • trunk/bp-blogs/bp-blogs-loader.php

    r4211 r4281  
    102102         */
    103103        if ( !is_multisite() )
    104             return false;
     104            return;
     105
     106        // Stop if there is no user displayed
     107        if ( empty( $bp->displayed_user->id ) )
     108            return;
    105109
    106110        // Add 'Blogs' to the main navigation
    107         $main_nav =  array(
     111        $main_nav = array(
    108112            'name'                => sprintf( __( 'Blogs <span>(%d)</span>', 'buddypress' ), bp_blogs_total_blogs_for_user() ),
    109113            'slug'                => $this->slug,
  • trunk/bp-core/bp-core-component.php

    r4265 r4281  
    222222     */
    223223    function _setup_nav( $main_nav = '', $sub_nav = '' ) {
    224 
    225224        // No sub nav items without a main nav item
    226225        if ( !empty( $main_nav ) ) {
  • trunk/bp-friends/bp-friends-loader.php

    r4211 r4281  
    9292    function _setup_nav() {
    9393        global $bp;
     94
     95        // Stop if there is no user displayed
     96        if ( empty( $bp->displayed_user->id ) )
     97            return;
    9498
    9599        // Add 'Friends' to the main navigation
  • trunk/bp-members/bp-members-loader.php

    r4211 r4281  
    144144        global $bp;
    145145
     146        // Stop if there is no user displayed and not logged in
     147        if ( !is_user_logged_in() && empty( $bp->displayed_user->id ) )
     148            return;
     149
    146150        // Add 'Profile' to the main navigation
    147151        if ( !bp_is_active( 'xprofile' ) ) {
     
    156160
    157161            // User links
    158             $user_domain   = ( isset( $bp->displayed_user->domain ) )               ? $bp->displayed_user->domain               : $bp->loggedin_user->domain;
    159             $user_login    = ( isset( $bp->displayed_user->userdata->user_login ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;
     162            $user_domain   = ( !empty( $bp->displayed_user->domain ) )               ? $bp->displayed_user->domain               : $bp->loggedin_user->domain;
     163            $user_login    = ( !empty( $bp->displayed_user->userdata->user_login ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;
    160164            $profile_link  = trailingslashit( $user_domain . $bp->profile->slug );
    161165
  • trunk/bp-messages/bp-messages-loader.php

    r4211 r4281  
    9393        global $bp;
    9494
     95        // Stop if there is no user displayed
     96        if ( empty( $bp->displayed_user->id ) )
     97            return;
     98
    9599        if ( $count = messages_get_unread_count() )
    96100            $name = sprintf( __( 'Messages <strong>(%s)</strong>', 'buddypress' ), $count );
  • trunk/bp-settings/bp-settings-loader.php

    r4211 r4281  
    6868    function _setup_nav() {
    6969        global $bp;
     70
     71        // Stop if there is no user displayed
     72        if ( empty( $bp->displayed_user->id ) )
     73            return;
    7074
    7175        // Add the settings navigation item
  • trunk/bp-xprofile/bp-xprofile-loader.php

    r4273 r4281  
    111111        global $bp;
    112112
     113        // Stop if there is no user displayed
     114        if ( empty( $bp->displayed_user->id ) )
     115            return;
     116
    113117        // Add 'Profile' to the main navigation
    114118        $main_nav = array(
Note: See TracChangeset for help on using the changeset viewer.