Ticket #25162: 25162.diff
File 25162.diff, 2.6 KB (added by , 10 years ago) |
---|
-
src/wp-login.php
840 840 elseif ( is_multisite() && !$user->has_cap('read') ) 841 841 $redirect_to = get_dashboard_url( $user->ID ); 842 842 elseif ( !$user->has_cap('edit_posts') ) 843 $redirect_to = admin_url('profile.php');843 $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url(); 844 844 } 845 845 wp_safe_redirect($redirect_to); 846 846 exit(); -
src/wp-includes/admin-bar.php
174 174 function wp_admin_bar_my_account_item( $wp_admin_bar ) { 175 175 $user_id = get_current_user_id(); 176 176 $current_user = wp_get_current_user(); 177 $profile_url = get_edit_profile_url( $user_id );178 177 179 178 if ( ! $user_id ) 180 179 return; 181 180 181 $profile_url = current_user_can( 'read' ) ? get_edit_profile_url( $user_id ) : '#'; 182 182 183 $avatar = get_avatar( $user_id, 26 ); 183 184 $howdy = sprintf( __('Howdy, %1$s'), $current_user->display_name ); 184 185 $class = empty( $avatar ) ? '' : 'with-avatar'; … … 204 205 function wp_admin_bar_my_account_menu( $wp_admin_bar ) { 205 206 $user_id = get_current_user_id(); 206 207 $current_user = wp_get_current_user(); 207 $profile_url = get_edit_profile_url( $user_id );208 208 209 209 if ( ! $user_id ) 210 210 return; 211 211 212 $profile_url = current_user_can( 'read' ) ? get_edit_profile_url( $user_id ) : '#'; 213 212 214 $wp_admin_bar->add_group( array( 213 215 'parent' => 'my-account', 214 216 'id' => 'user-actions', … … 229 231 'tabindex' => -1, 230 232 ), 231 233 ) ); 232 $wp_admin_bar->add_menu( array( 233 'parent' => 'user-actions', 234 'id' => 'edit-profile', 235 'title' => __( 'Edit My Profile' ), 236 'href' => $profile_url, 237 ) ); 234 if ( current_user_can( 'read' ) ) { 235 $wp_admin_bar->add_menu( array( 236 'parent' => 'user-actions', 237 'id' => 'edit-profile', 238 'title' => __( 'Edit My Profile' ), 239 'href' => $profile_url, 240 ) ); 241 } 242 238 243 $wp_admin_bar->add_menu( array( 239 244 'parent' => 'user-actions', 240 245 'id' => 'logout', … … 276 281 $wp_admin_bar->add_menu( array( 277 282 'id' => 'site-name', 278 283 'title' => $title, 279 'href' => is_admin() ? home_url( '/' ) : admin_url(),284 'href' => ( is_admin() || ! current_user_can( 'read' ) ) ? home_url( '/' ) : admin_url(), 280 285 ) ); 281 286 282 287 // Create submenu items. … … 299 304 ) ); 300 305 } 301 306 302 } else {307 } else if ( current_user_can( 'read' ) ) { 303 308 // We're on the front end, link to the Dashboard. 304 309 $wp_admin_bar->add_menu( array( 305 310 'parent' => 'site-name',