WordPress.org

Make WordPress Core

Changeset 17351


Ignore:
Timestamp:
01/22/2011 06:29:43 PM (7 years ago)
Author:
ryan
Message:

Don't try to redirect to user admin for unpriv users unless a site admin redirect was requested. fixes #16297

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-login.php

    r17332 r17351  
    584584        }
    585585
    586         // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
    587         if ( is_multisite() && !get_active_blog_for_user($user->id) )
    588             $redirect_to = user_admin_url();
    589         elseif ( is_multisite() && !$user->has_cap('read') )
    590             $redirect_to = user_admin_url();
    591         elseif ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) )
    592             $redirect_to = admin_url('profile.php');
     586        if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) {
     587            // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
     588            if ( is_multisite() && !get_active_blog_for_user($user->id) )
     589                $redirect_to = user_admin_url();
     590            elseif ( is_multisite() && !$user->has_cap('read') )
     591                $redirect_to = user_admin_url();
     592            elseif ( !$user->has_cap('edit_posts') )
     593                $redirect_to = admin_url('profile.php');
     594        }
    593595        wp_safe_redirect($redirect_to);
    594596        exit();
Note: See TracChangeset for help on using the changeset viewer.