Changeset 167 for trunk/bp-xprofile.php
- Timestamp:
- 06/19/08 17:10:30 (7 months ago)
- Files:
-
- 1 modified
-
trunk/bp-xprofile.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile.php
r166 r167 136 136 137 137 function 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 140 141 $bp_nav[0] = array( 141 142 'id' => $bp_xprofile_slug, 142 143 'name' => 'Profile', 143 'link' => $ source_domain . $bp_xprofile_slug144 'link' => $loggedin_domain . $bp_xprofile_slug 144 145 ); 145 146 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 } 157 160 } 158 161 add_action( 'wp', 'xprofile_setup_nav' ); … … 166 169 167 170 function 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; 169 173 170 174 if ( $current_component == $bp_xprofile_slug && $current_blog->blog_id > 1 ) { 171 if ( !$current_action ) 175 if ( !$current_action ) { 172 176 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 ) { 175 178 bp_catch_uri( 'profile/edit' ); 176 177 if ( $current_action == 'change-avatar' ) 179 } else if ( $current_action == 'change-avatar' && $loggedin_userid == $current_userid ) { 178 180 bp_catch_uri( 'profile/change-avatar' ); 181 } else { 182 bp_catch_uri( 'profile/index' ); 183 } 179 184 } 180 185 } … … 190 195 191 196 function 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); 203 200 } 204 201 add_action( 'wp_head', 'xprofile_profile_template' ); … … 212 209 213 210 function 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; 215 212 216 213 if ( !$group_id ) { … … 225 222 226 223 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'; 228 225 ?> 229 226 <div class="wrap">
