diff --git wp-includes/pluggable-deprecated.php wp-includes/pluggable-deprecated.php
index 2a202ac..a3983c0 100644
|
|
function set_current_user($id, $name = '') { |
36 | 36 | } |
37 | 37 | endif; |
38 | 38 | |
| 39 | if ( !function_exists('get_currentuserinfo') ) : |
| 40 | /** |
| 41 | * Populate global variables with information about the currently logged in user. |
| 42 | * |
| 43 | * @since 0.71 |
| 44 | * |
| 45 | * @return bool|WP_User False on XMLRPC Request and invalid auth cookie, WP_User instance otherwise. |
| 46 | */ |
| 47 | function get_currentuserinfo() { |
| 48 | _deprecated_function( __FUNCTION__, '3.4', 'wp_get_current_user()' ); |
| 49 | |
| 50 | return wp_get_current_user(); |
| 51 | } |
| 52 | endif; |
| 53 | |
39 | 54 | if ( !function_exists('get_userdatabylogin') ) : |
40 | 55 | /** |
41 | 56 | * Retrieve user info by login name. |
diff --git wp-includes/pluggable.php wp-includes/pluggable.php
index 7855004..b503421 100644
|
|
if ( !function_exists('wp_get_current_user') ) : |
44 | 44 | /** |
45 | 45 | * Retrieve the current user object. |
46 | 46 | * |
47 | | * @since 2.0.3 |
48 | | * |
49 | | * @return WP_User Current user WP_User object |
50 | | */ |
51 | | function wp_get_current_user() { |
52 | | global $current_user; |
53 | | |
54 | | get_currentuserinfo(); |
55 | | |
56 | | return $current_user; |
57 | | } |
58 | | endif; |
59 | | |
60 | | if ( !function_exists('get_currentuserinfo') ) : |
61 | | /** |
62 | | * Populate global variables with information about the currently logged in user. |
63 | | * |
64 | 47 | * Will set the current user, if the current user is not set. The current user |
65 | 48 | * will be set to the logged in person. If no user is logged in, then it will |
66 | 49 | * set the current user to 0, which is invalid and won't have any permissions. |
67 | 50 | * |
68 | | * @since 0.71 |
69 | | * @uses $current_user Checks if the current user is set |
| 51 | * @since 2.0.3 |
| 52 | * |
70 | 53 | * @uses wp_validate_auth_cookie() Retrieves current logged in user. |
71 | 54 | * |
72 | | * @return bool|null False on XMLRPC Request and invalid auth cookie. Null when current user set |
| 55 | * @return bool|WP_User False on XMLRPC Request and invalid auth cookie, WP_User instance otherwise. |
73 | 56 | */ |
74 | | function get_currentuserinfo() { |
| 57 | function wp_get_current_user() { |
75 | 58 | global $current_user; |
76 | 59 | |
77 | 60 | if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) |
78 | 61 | return false; |
79 | 62 | |
80 | | if ( ! empty($current_user) ) |
81 | | return; |
| 63 | if ( ! empty( $current_user ) ) |
| 64 | return $current_user; |
82 | 65 | |
83 | 66 | if ( ! $user = wp_validate_auth_cookie() ) { |
84 | 67 | if ( is_blog_admin() || is_network_admin() || empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) { |
… |
… |
function get_currentuserinfo() { |
88 | 71 | } |
89 | 72 | |
90 | 73 | wp_set_current_user($user); |
| 74 | |
| 75 | return $current_user; |
91 | 76 | } |
92 | 77 | endif; |
93 | 78 | |