| 18 | | if ( !function_exists('set_current_user') ) : |
| 19 | | /** |
| 20 | | * Changes the current user by ID or name. |
| 21 | | * |
| 22 | | * Set $id to null and specify a name if you do not know a user's ID. |
| 23 | | * |
| 24 | | * @since 2.0.1 |
| 25 | | * @deprecated 3.0.0 Use wp_set_current_user() |
| 26 | | * @see wp_set_current_user() |
| 27 | | * |
| 28 | | * @param int|null $id User ID. |
| 29 | | * @param string $name Optional. The user's username |
| 30 | | * @return WP_User returns wp_set_current_user() |
| 31 | | */ |
| 32 | | function set_current_user($id, $name = '') { |
| 33 | | _deprecated_function( __FUNCTION__, '3.0.0', 'wp_set_current_user()' ); |
| 34 | | return wp_set_current_user($id, $name); |
| 35 | | } |
| | 18 | if ( ! function_exists('set_current_user') ) : |
| | 19 | /** |
| | 20 | * Changes the current user by ID or name. |
| | 21 | * |
| | 22 | * Set $id to null and specify a name if you do not know a user's ID. |
| | 23 | * |
| | 24 | * @since 2.0.1 |
| | 25 | * @deprecated 3.0.0 Use wp_set_current_user() |
| | 26 | * @see wp_set_current_user() |
| | 27 | * |
| | 28 | * @param int|null $id User ID. |
| | 29 | * @param string $name Optional. The user's username |
| | 30 | * @return WP_User returns wp_set_current_user() |
| | 31 | */ |
| | 32 | function set_current_user($id, $name = '') { |
| | 33 | _deprecated_function( __FUNCTION__, '3.0.0', 'wp_set_current_user()' ); |
| | 34 | return wp_set_current_user($id, $name); |
| | 35 | } |
| 38 | | if ( !function_exists('get_currentuserinfo') ) : |
| 39 | | /** |
| 40 | | * Populate global variables with information about the currently logged in user. |
| 41 | | * |
| 42 | | * @since 0.71 |
| 43 | | * @deprecated 4.5.0 Use wp_get_current_user() |
| 44 | | * @see wp_get_current_user() |
| 45 | | * |
| 46 | | * @return bool|WP_User False on XMLRPC Request and invalid auth cookie, WP_User instance otherwise. |
| 47 | | */ |
| 48 | | function get_currentuserinfo() { |
| 49 | | _deprecated_function( __FUNCTION__, '4.5.0', 'wp_get_current_user()' ); |
| | 38 | if ( ! function_exists('get_currentuserinfo') ) : |
| | 39 | /** |
| | 40 | * Populate global variables with information about the currently logged in user. |
| | 41 | * |
| | 42 | * @since 0.71 |
| | 43 | * @deprecated 4.5.0 Use wp_get_current_user() |
| | 44 | * @see wp_get_current_user() |
| | 45 | * |
| | 46 | * @return bool|WP_User False on XMLRPC Request and invalid auth cookie, WP_User instance otherwise. |
| | 47 | */ |
| | 48 | function get_currentuserinfo() { |
| | 49 | _deprecated_function( __FUNCTION__, '4.5.0', 'wp_get_current_user()' ); |
| 55 | | if ( !function_exists('get_userdatabylogin') ) : |
| 56 | | /** |
| 57 | | * Retrieve user info by login name. |
| 58 | | * |
| 59 | | * @since 0.71 |
| 60 | | * @deprecated 3.3.0 Use get_user_by() |
| 61 | | * @see get_user_by() |
| 62 | | * |
| 63 | | * @param string $user_login User's username |
| 64 | | * @return bool|object False on failure, User DB row object |
| 65 | | */ |
| 66 | | function get_userdatabylogin($user_login) { |
| 67 | | _deprecated_function( __FUNCTION__, '3.3.0', "get_user_by('login')" ); |
| 68 | | return get_user_by('login', $user_login); |
| 69 | | } |
| | 55 | if ( ! function_exists('get_userdatabylogin') ) : |
| | 56 | /** |
| | 57 | * Retrieve user info by login name. |
| | 58 | * |
| | 59 | * @since 0.71 |
| | 60 | * @deprecated 3.3.0 Use get_user_by() |
| | 61 | * @see get_user_by() |
| | 62 | * |
| | 63 | * @param string $user_login User's username |
| | 64 | * @return bool|object False on failure, User DB row object |
| | 65 | */ |
| | 66 | function get_userdatabylogin($user_login) { |
| | 67 | _deprecated_function( __FUNCTION__, '3.3.0', "get_user_by('login')" ); |
| | 68 | return get_user_by('login', $user_login); |
| | 69 | } |
| 72 | | if ( !function_exists('get_user_by_email') ) : |
| 73 | | /** |
| 74 | | * Retrieve user info by email. |
| 75 | | * |
| 76 | | * @since 2.5.0 |
| 77 | | * @deprecated 3.3.0 Use get_user_by() |
| 78 | | * @see get_user_by() |
| 79 | | * |
| 80 | | * @param string $email User's email address |
| 81 | | * @return bool|object False on failure, User DB row object |
| 82 | | */ |
| 83 | | function get_user_by_email($email) { |
| 84 | | _deprecated_function( __FUNCTION__, '3.3.0', "get_user_by('email')" ); |
| 85 | | return get_user_by('email', $email); |
| 86 | | } |
| | 72 | if ( ! function_exists('get_user_by_email') ) : |
| | 73 | /** |
| | 74 | * Retrieve user info by email. |
| | 75 | * |
| | 76 | * @since 2.5.0 |
| | 77 | * @deprecated 3.3.0 Use get_user_by() |
| | 78 | * @see get_user_by() |
| | 79 | * |
| | 80 | * @param string $email User's email address |
| | 81 | * @return bool|object False on failure, User DB row object |
| | 82 | */ |
| | 83 | function get_user_by_email($email) { |
| | 84 | _deprecated_function( __FUNCTION__, '3.3.0', "get_user_by('email')" ); |
| | 85 | return get_user_by('email', $email); |
| | 86 | } |
| 89 | | if ( !function_exists('wp_setcookie') ) : |
| 90 | | /** |
| 91 | | * Sets a cookie for a user who just logged in. This function is deprecated. |
| 92 | | * |
| 93 | | * @since 1.5.0 |
| 94 | | * @deprecated 2.5.0 Use wp_set_auth_cookie() |
| 95 | | * @see wp_set_auth_cookie() |
| 96 | | * |
| 97 | | * @param string $username The user's username |
| 98 | | * @param string $password Optional. The user's password |
| 99 | | * @param bool $already_md5 Optional. Whether the password has already been through MD5 |
| 100 | | * @param string $home Optional. Will be used instead of COOKIEPATH if set |
| 101 | | * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set |
| 102 | | * @param bool $remember Optional. Remember that the user is logged in |
| 103 | | */ |
| 104 | | function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) { |
| 105 | | _deprecated_function( __FUNCTION__, '2.5.0', 'wp_set_auth_cookie()' ); |
| 106 | | $user = get_user_by('login', $username); |
| 107 | | wp_set_auth_cookie($user->ID, $remember); |
| 108 | | } |
| | 89 | if ( ! function_exists('wp_setcookie') ) : |
| | 90 | /** |
| | 91 | * Sets a cookie for a user who just logged in. This function is deprecated. |
| | 92 | * |
| | 93 | * @since 1.5.0 |
| | 94 | * @deprecated 2.5.0 Use wp_set_auth_cookie() |
| | 95 | * @see wp_set_auth_cookie() |
| | 96 | * |
| | 97 | * @param string $username The user's username |
| | 98 | * @param string $password Optional. The user's password |
| | 99 | * @param bool $already_md5 Optional. Whether the password has already been through MD5 |
| | 100 | * @param string $home Optional. Will be used instead of COOKIEPATH if set |
| | 101 | * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set |
| | 102 | * @param bool $remember Optional. Remember that the user is logged in |
| | 103 | */ |
| | 104 | function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) { |
| | 105 | _deprecated_function( __FUNCTION__, '2.5.0', 'wp_set_auth_cookie()' ); |
| | 106 | $user = get_user_by('login', $username); |
| | 107 | wp_set_auth_cookie($user->ID, $remember); |
| | 108 | } |
| 113 | | if ( !function_exists('wp_clearcookie') ) : |
| 114 | | /** |
| 115 | | * Clears the authentication cookie, logging the user out. This function is deprecated. |
| 116 | | * |
| 117 | | * @since 1.5.0 |
| 118 | | * @deprecated 2.5.0 Use wp_clear_auth_cookie() |
| 119 | | * @see wp_clear_auth_cookie() |
| 120 | | */ |
| 121 | | function wp_clearcookie() { |
| 122 | | _deprecated_function( __FUNCTION__, '2.5.0', 'wp_clear_auth_cookie()' ); |
| 123 | | wp_clear_auth_cookie(); |
| 124 | | } |
| | 113 | if ( ! function_exists('wp_clearcookie') ) : |
| | 114 | /** |
| | 115 | * Clears the authentication cookie, logging the user out. This function is deprecated. |
| | 116 | * |
| | 117 | * @since 1.5.0 |
| | 118 | * @deprecated 2.5.0 Use wp_clear_auth_cookie() |
| | 119 | * @see wp_clear_auth_cookie() |
| | 120 | */ |
| | 121 | function wp_clearcookie() { |
| | 122 | _deprecated_function( __FUNCTION__, '2.5.0', 'wp_clear_auth_cookie()' ); |
| | 123 | wp_clear_auth_cookie(); |
| | 124 | } |
| 129 | | if ( !function_exists('wp_get_cookie_login') ): |
| 130 | | /** |
| 131 | | * Gets the user cookie login. This function is deprecated. |
| 132 | | * |
| 133 | | * This function is deprecated and should no longer be extended as it won't be |
| 134 | | * used anywhere in WordPress. Also, plugins shouldn't use it either. |
| 135 | | * |
| 136 | | * @since 2.0.3 |
| 137 | | * @deprecated 2.5.0 |
| 138 | | * |
| 139 | | * @return bool Always returns false |
| 140 | | */ |
| 141 | | function wp_get_cookie_login() { |
| 142 | | _deprecated_function( __FUNCTION__, '2.5.0' ); |
| 143 | | return false; |
| 144 | | } |
| | 129 | if ( ! function_exists('wp_get_cookie_login') ): |
| | 130 | /** |
| | 131 | * Gets the user cookie login. This function is deprecated. |
| | 132 | * |
| | 133 | * This function is deprecated and should no longer be extended as it won't be |
| | 134 | * used anywhere in WordPress. Also, plugins shouldn't use it either. |
| | 135 | * |
| | 136 | * @since 2.0.3 |
| | 137 | * @deprecated 2.5.0 |
| | 138 | * |
| | 139 | * @return bool Always returns false |
| | 140 | */ |
| | 141 | function wp_get_cookie_login() { |
| | 142 | _deprecated_function( __FUNCTION__, '2.5.0' ); |
| | 143 | return false; |
| | 144 | } |
| 149 | | if ( !function_exists('wp_login') ) : |
| 150 | | /** |
| 151 | | * Checks a users login information and logs them in if it checks out. This function is deprecated. |
| 152 | | * |
| 153 | | * Use the global $error to get the reason why the login failed. If the username |
| 154 | | * is blank, no error will be set, so assume blank username on that case. |
| 155 | | * |
| 156 | | * Plugins extending this function should also provide the global $error and set |
| 157 | | * what the error is, so that those checking the global for why there was a |
| 158 | | * failure can utilize it later. |
| 159 | | * |
| 160 | | * @since 1.2.2 |
| 161 | | * @deprecated 2.5.0 Use wp_signon() |
| 162 | | * @see wp_signon() |
| 163 | | * |
| 164 | | * @global string $error Error when false is returned |
| 165 | | * |
| 166 | | * @param string $username User's username |
| 167 | | * @param string $password User's password |
| 168 | | * @param string $deprecated Not used |
| 169 | | * @return bool True on successful check, false on login failure. |
| 170 | | */ |
| 171 | | function wp_login($username, $password, $deprecated = '') { |
| 172 | | _deprecated_function( __FUNCTION__, '2.5.0', 'wp_signon()' ); |
| 173 | | global $error; |
| | 149 | if ( ! function_exists('wp_login') ) : |
| | 150 | /** |
| | 151 | * Checks a users login information and logs them in if it checks out. This function is deprecated. |
| | 152 | * |
| | 153 | * Use the global $error to get the reason why the login failed. If the username |
| | 154 | * is blank, no error will be set, so assume blank username on that case. |
| | 155 | * |
| | 156 | * Plugins extending this function should also provide the global $error and set |
| | 157 | * what the error is, so that those checking the global for why there was a |
| | 158 | * failure can utilize it later. |
| | 159 | * |
| | 160 | * @since 1.2.2 |
| | 161 | * @deprecated 2.5.0 Use wp_signon() |
| | 162 | * @see wp_signon() |
| | 163 | * |
| | 164 | * @global string $error Error when false is returned |
| | 165 | * |
| | 166 | * @param string $username User's username |
| | 167 | * @param string $password User's password |
| | 168 | * @param string $deprecated Not used |
| | 169 | * @return bool True on successful check, false on login failure. |
| | 170 | */ |
| | 171 | function wp_login($username, $password, $deprecated = '') { |
| | 172 | _deprecated_function( __FUNCTION__, '2.5.0', 'wp_signon()' ); |
| | 173 | global $error; |