3 * Deprecated pluggable functions from past WordPress versions. You shouldn't use these
4 * functions and look for the alternatives instead. The functions will be removed in a
7 * Deprecated warnings are also thrown if one of these functions is being defined by a plugin.
10 * @subpackage Deprecated
15 * Deprecated functions come here to die.
18 if ( !function_exists('set_current_user') ) :
20 * Changes the current user by ID or name.
22 * Set $id to null and specify a name if you do not know a user's ID.
25 * @see wp_set_current_user() An alias of wp_set_current_user()
27 * @deprecated Use wp_set_current_user()
29 * @param int|null $id User ID.
30 * @param string $name Optional. The user's username
31 * @return object returns wp_set_current_user()
33 function set_current_user($id, $name = '') {
34 _deprecated_function( __FUNCTION__, '3.0', 'wp_set_current_user()' );
35 return wp_set_current_user($id, $name);
39 if ( !function_exists('wp_setcookie') ) :
41 * Sets a cookie for a user who just logged in. This function is deprecated.
45 * @deprecated Use wp_set_auth_cookie()
46 * @see wp_set_auth_cookie()
48 * @param string $username The user's username
49 * @param string $password Optional. The user's password
50 * @param bool $already_md5 Optional. Whether the password has already been through MD5
51 * @param string $home Optional. Will be used instead of COOKIEPATH if set
52 * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set
53 * @param bool $remember Optional. Remember that the user is logged in
55 function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
56 _deprecated_function( __FUNCTION__, '2.5', 'wp_set_auth_cookie()' );
57 $user = get_userdatabylogin($username);
58 wp_set_auth_cookie($user->ID, $remember);
61 _deprecated_function( 'wp_setcookie', '2.5', 'wp_set_auth_cookie()' );
64 if ( !function_exists('wp_clearcookie') ) :
66 * Clears the authentication cookie, logging the user out. This function is deprecated.
70 * @deprecated Use wp_clear_auth_cookie()
71 * @see wp_clear_auth_cookie()
73 function wp_clearcookie() {
74 _deprecated_function( __FUNCTION__, '2.5', 'wp_clear_auth_cookie()' );
75 wp_clear_auth_cookie();
78 _deprecated_function( 'wp_clearcookie', '2.5', 'wp_clear_auth_cookie()' );
81 if ( !function_exists('wp_get_cookie_login') ):
83 * Gets the user cookie login. This function is deprecated.
85 * This function is deprecated and should no longer be extended as it won't be
86 * used anywhere in WordPress. Also, plugins shouldn't use it either.
90 * @deprecated No alternative
92 * @return bool Always returns false
94 function wp_get_cookie_login() {
95 _deprecated_function( __FUNCTION__, '2.5' );
99 _deprecated_function( 'wp_get_cookie_login', '2.5' );
102 if ( !function_exists('wp_login') ) :
104 * Checks a users login information and logs them in if it checks out. This function is deprecated.
106 * Use the global $error to get the reason why the login failed. If the username
107 * is blank, no error will be set, so assume blank username on that case.
109 * Plugins extending this function should also provide the global $error and set
110 * what the error is, so that those checking the global for why there was a
111 * failure can utilize it later.
114 * @deprecated Use wp_signon()
115 * @global string $error Error when false is returned
117 * @param string $username User's username
118 * @param string $password User's password
119 * @param bool $deprecated Not used
120 * @return bool False on login failure, true on successful check
122 function wp_login($username, $password, $deprecated = '') {
123 _deprecated_function( __FUNCTION__, '2.5', 'wp_signon()' );
126 $user = wp_authenticate($username, $password);
128 if ( ! is_wp_error($user) )
131 $error = $user->get_error_message();
135 _deprecated_function( 'wp_login', '2.5', 'wp_signon()' );