Changeset 167 for trunk/bp-xprofile.php

Show
Ignore:
Timestamp:
06/19/08 17:10:30 (7 months ago)
Author:
apeatling
Message:

Fixed issues with subdirectory WPMU installations and BuddyPress

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile.php

    r166 r167  
    136136 
    137137function xprofile_setup_nav() { 
    138         global $source_domain, $bp_nav, $bp_options_nav, $bp_xprofile_slug; 
    139  
     138        global $loggedin_domain, $bp_nav, $bp_options_nav; 
     139        global $loggedin_userid, $current_userid, $bp_xprofile_slug; 
     140         
    140141        $bp_nav[0] = array( 
    141142                'id'    => $bp_xprofile_slug, 
    142143                'name'  => 'Profile',  
    143                 'link'  => $source_domain . $bp_xprofile_slug 
     144                'link'  => $loggedin_domain . $bp_xprofile_slug 
    144145        ); 
    145146 
    146         $bp_options_nav[$bp_xprofile_slug] = array( 
    147                 ''                 => array(  
    148                         'name' => __('Publically Viewable'), 
    149                         'link' => $source_domain . $bp_xprofile_slug . '/' ), 
    150                 'edit'                  => array( 
    151                         'name' => __('Edit Profile'), 
    152                         'link' => $source_domain . $bp_xprofile_slug . '/edit' ), 
    153                 'change-avatar' => array(  
    154                         'name' => __('Change Avatar'), 
    155                         'link' => $source_domain . $bp_xprofile_slug . '/change-avatar' ) 
    156         ); 
     147        if ( $loggedin_userid == $current_userid ) { 
     148                $bp_options_nav[$bp_xprofile_slug] = array( 
     149                        ''                 => array(  
     150                                'name' => __('Publically Viewable'), 
     151                                'link' => $loggedin_domain . $bp_xprofile_slug . '/' ), 
     152                        'edit'                  => array( 
     153                                'name' => __('Edit Profile'), 
     154                                'link' => $loggedin_domain . $bp_xprofile_slug . '/edit' ), 
     155                        'change-avatar' => array(  
     156                                'name' => __('Change Avatar'), 
     157                                'link' => $loggedin_domain . $bp_xprofile_slug . '/change-avatar' ) 
     158                ); 
     159        } 
    157160} 
    158161add_action( 'wp', 'xprofile_setup_nav' ); 
     
    166169 
    167170function xprofile_catch_action() { 
    168         global $bp_xprofile_slug, $current_component, $current_blog, $current_action; 
     171        global $bp_xprofile_slug, $current_component, $current_blog; 
     172        global $loggedin_userid, $current_userid, $current_action; 
    169173 
    170174        if ( $current_component == $bp_xprofile_slug && $current_blog->blog_id > 1 ) { 
    171                 if ( !$current_action ) 
     175                if ( !$current_action ) { 
    172176                        bp_catch_uri( 'profile/index' ); 
    173  
    174                 if ( $current_action == 'edit' && !$action_variables ) 
     177                } else if ( $current_action == 'edit' && !$action_variables && $loggedin_userid == $current_userid ) { 
    175178                        bp_catch_uri( 'profile/edit' ); 
    176  
    177                 if ( $current_action == 'change-avatar' ) 
     179                } else if ( $current_action == 'change-avatar' && $loggedin_userid == $current_userid ) { 
    178180                        bp_catch_uri( 'profile/change-avatar' ); 
     181                } else { 
     182                        bp_catch_uri( 'profile/index' ); 
     183                } 
    179184        } 
    180185} 
     
    190195 
    191196function xprofile_profile_template() { 
    192         global $current_blog, $profile_template, $coreuser_id; 
    193  
    194         if ( VHOST == 'yes' ) { 
    195                 $siteuser = explode('.', $current_blog->domain); 
    196                 $siteuser = $siteuser[0]; 
    197         } else { 
    198                 $siteuser = str_replace('/', '', $current_blog->path); 
    199         } 
    200  
    201         $coreuser_id = bp_core_get_userid($siteuser); 
    202         $profile_template = new BP_XProfile_Template($coreuser_id); 
     197        global $profile_template, $current_userid; 
     198 
     199        $profile_template = new BP_XProfile_Template($current_userid); 
    203200} 
    204201add_action( 'wp_head', 'xprofile_profile_template' ); 
     
    212209 
    213210function xprofile_edit( $group_id = null, $action = null ) { 
    214         global $wpdb, $bp_xprofile_table_name_groups, $userdata, $source_domain; 
     211        global $wpdb, $bp_xprofile_table_name_groups, $userdata, $loggedin_domain; 
    215212         
    216213        if ( !$group_id ) {      
     
    225222         
    226223        if ( !$action ) 
    227                 $action = $source_domain . 'wp-admin/admin.php?page=xprofile_' . $group->name . '&mode=save'; 
     224                $action = $loggedin_domain . 'wp-admin/admin.php?page=xprofile_' . $group->name . '&mode=save'; 
    228225?> 
    229226        <div class="wrap">