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

git-svn-id: http://svn.automattic.com/wordpress/trunk@17351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2011-01-22 18:29:43 +00:00
parent a1d3c1c62a
commit 8249212f7d
1 changed files with 9 additions and 7 deletions

View File

@ -583,13 +583,15 @@ default:
<?php exit;
}
// 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.
if ( is_multisite() && !get_active_blog_for_user($user->id) )
$redirect_to = user_admin_url();
elseif ( is_multisite() && !$user->has_cap('read') )
$redirect_to = user_admin_url();
elseif ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) )
$redirect_to = admin_url('profile.php');
if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) {
// 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.
if ( is_multisite() && !get_active_blog_for_user($user->id) )
$redirect_to = user_admin_url();
elseif ( is_multisite() && !$user->has_cap('read') )
$redirect_to = user_admin_url();
elseif ( !$user->has_cap('edit_posts') )
$redirect_to = admin_url('profile.php');
}
wp_safe_redirect($redirect_to);
exit();
}