]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/pluggable-deprecated.php
Wordpress 3.0.5-scripts
[autoinstalls/wordpress.git] / wp-includes / pluggable-deprecated.php
1 <?php
2 /**
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
5  * later version.
6  *
7  * Deprecated warnings are also thrown if one of these functions is being defined by a plugin.
8  *
9  * @package WordPress
10  * @subpackage Deprecated
11  * @see pluggable.php
12  */
13
14 /*
15  * Deprecated functions come here to die.
16  */
17
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  * @see wp_set_current_user() An alias of wp_set_current_user()
26  * @deprecated 3.0.0
27  * @deprecated Use wp_set_current_user()
28  *
29  * @param int|null $id User ID.
30  * @param string $name Optional. The user's username
31  * @return object returns wp_set_current_user()
32  */
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);
36 }
37 endif;
38
39 if ( !function_exists('wp_setcookie') ) :
40 /**
41  * Sets a cookie for a user who just logged in. This function is deprecated.
42  *
43  * @since 1.5
44  * @deprecated 2.5
45  * @deprecated Use wp_set_auth_cookie()
46  * @see wp_set_auth_cookie()
47  *
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
54  */
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);
59 }
60 else :
61         _deprecated_function( 'wp_setcookie', '2.5', 'wp_set_auth_cookie()' );
62 endif;
63
64 if ( !function_exists('wp_clearcookie') ) :
65 /**
66  * Clears the authentication cookie, logging the user out. This function is deprecated.
67  *
68  * @since 1.5
69  * @deprecated 2.5
70  * @deprecated Use wp_clear_auth_cookie()
71  * @see wp_clear_auth_cookie()
72  */
73 function wp_clearcookie() {
74         _deprecated_function( __FUNCTION__, '2.5', 'wp_clear_auth_cookie()' );
75         wp_clear_auth_cookie();
76 }
77 else :
78         _deprecated_function( 'wp_clearcookie', '2.5', 'wp_clear_auth_cookie()' );
79 endif;
80
81 if ( !function_exists('wp_get_cookie_login') ):
82 /**
83  * Gets the user cookie login. This function is deprecated.
84  *
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.
87  *
88  * @since 2.0.3
89  * @deprecated 2.5
90  * @deprecated No alternative
91  *
92  * @return bool Always returns false
93  */
94 function wp_get_cookie_login() {
95         _deprecated_function( __FUNCTION__, '2.5' );
96         return false;
97 }
98 else :
99         _deprecated_function( 'wp_get_cookie_login', '2.5' );
100 endif;
101
102 if ( !function_exists('wp_login') ) :
103 /**
104  * Checks a users login information and logs them in if it checks out. This function is deprecated.
105  *
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.
108  *
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.
112  *
113  * @since 1.2.2
114  * @deprecated Use wp_signon()
115  * @global string $error Error when false is returned
116  *
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
121  */
122 function wp_login($username, $password, $deprecated = '') {
123         _deprecated_function( __FUNCTION__, '2.5', 'wp_signon()' );
124         global $error;
125
126         $user = wp_authenticate($username, $password);
127
128         if ( ! is_wp_error($user) )
129                 return true;
130
131         $error = $user->get_error_message();
132         return false;
133 }
134 else :
135         _deprecated_function( 'wp_login', '2.5', 'wp_signon()' );
136 endif;