Move the optimization done to get_user_by() in [21376] higher up the stack, into map_meta_cap() and is_super_admin().

This provides nearly the same benefits without possibly receiving a stale object from get_userdata(),
which could affect authentication, and introduce side effects for plugins.

see #21120.



git-svn-id: https://develop.svn.wordpress.org/trunk@21563 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2012-08-20 21:58:34 +00:00
parent c4e51487e5
commit d41d58d128
2 changed files with 26 additions and 25 deletions
-3
View File
@@ -133,9 +133,6 @@ if ( !function_exists('get_user_by') ) :
* @return bool|object False on failure, WP_User object on success
*/
function get_user_by( $field, $value ) {
if ( 'id' === $field && (int) $value && get_current_user_id() === (int) $value )
return wp_get_current_user();
$userdata = WP_User::get_data_by( $field, $value );
if ( !$userdata )