Make WordPress Core

Ticket #25162: ticket-25162.diff

File ticket-25162.diff, 1.4 KB (added by pauldewouters, 10 years ago)
  • src/wp-includes/admin-bar.php

    diff --git src/wp-includes/admin-bar.php src/wp-includes/admin-bar.php
    index 0acefd0..b7fa8fe 100644
    function wp_admin_bar_sidebar_toggle( $wp_admin_bar ) { 
    182182function wp_admin_bar_my_account_item( $wp_admin_bar ) {
    183183        $user_id      = get_current_user_id();
    184184        $current_user = wp_get_current_user();
    185         $profile_url  = get_edit_profile_url( $user_id );
     185        $profile_url  = ( 0 < count( $user->allcaps ) ) ? get_edit_profile_url( $user_id ) : '#';
    186186
    187187        if ( ! $user_id )
    188188                return;
    function wp_admin_bar_my_account_item( $wp_admin_bar ) { 
    213213function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
    214214        $user_id      = get_current_user_id();
    215215        $current_user = wp_get_current_user();
    216         $profile_url  = get_edit_profile_url( $user_id );
     216        $profile_url  = ( 0 < count( $user->allcaps ) ) ? get_edit_profile_url( $user_id ) : '#';
    217217
    218218        if ( ! $user_id )
    219219                return;
  • src/wp-login.php

    diff --git src/wp-login.php src/wp-login.php
    index b9dbd61..060d8f5 100644
    default: 
    811811                        elseif ( is_multisite() && !$user->has_cap('read') )
    812812                                $redirect_to = get_dashboard_url( $user->ID );
    813813                        elseif ( !$user->has_cap('edit_posts') )
    814                                 $redirect_to = admin_url('profile.php');
     814                                $redirect_to = ( 0 < count( $user->allcaps ) ) ? admin_url('profile.php') : get_home_url();
    815815                }
    816816                wp_safe_redirect($redirect_to);
    817817                exit();