Ticket #21120: 21120.2.diff

File 21120.2.diff, 976 bytes (added by nacin, 10 months ago)

This ought to be API'd as suggested in the comment, but this does a number to the profiling output..

Line 
1Index: wp-includes/capabilities.php
2===================================================================
3--- wp-includes/capabilities.php        (revision 21256)
4+++ wp-includes/capabilities.php        (working copy)
5@@ -1380,7 +1380,7 @@
6  * @return bool True if the user is a site admin.
7  */
8 function is_super_admin( $user_id = false ) {
9-       if ( $user_id )
10+       if ( $user_id && $user_id != get_current_user_id() )
11                $user = new WP_User( $user_id );
12        else
13                $user = wp_get_current_user();
14Index: wp-includes/pluggable.php
15===================================================================
16--- wp-includes/pluggable.php   (revision 21256)
17+++ wp-includes/pluggable.php   (working copy)
18@@ -133,6 +133,9 @@
19  * @return bool|object False on failure, WP_User object on success
20  */
21 function get_user_by( $field, $value ) {
22+       if ( 'id' === $field && get_current_user_id() == $value )
23+               return wp_get_current_user();
24+
25        $userdata = WP_User::get_data_by( $field, $value );
26 
27        if ( !$userdata )