From b18ac8fcdba4ea90b3c0977c845e65ac21c663d9 Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 14 Apr 2010 22:06:03 +0000 Subject: [PATCH] Deprecate set_current_user() in favor of wp_set_current_user(). git-svn-id: http://svn.automattic.com/wordpress/trunk@14090 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/pluggable-deprecated.php | 21 +++++++++++++++++++++ wp-includes/pluggable.php | 18 ------------------ wp-includes/user.php | 3 +-- xmlrpc.php | 2 +- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/wp-includes/pluggable-deprecated.php b/wp-includes/pluggable-deprecated.php index 0b32760a2..bb0e4f0eb 100644 --- a/wp-includes/pluggable-deprecated.php +++ b/wp-includes/pluggable-deprecated.php @@ -15,6 +15,27 @@ * Deprecated functions come here to die. */ +if ( !function_exists('set_current_user') ) : +/** + * Changes the current user by ID or name. + * + * Set $id to null and specify a name if you do not know a user's ID. + * + * @since 2.0.1 + * @see wp_set_current_user() An alias of wp_set_current_user() + * @deprecated 3.0.0 + * @deprecated Use wp_set_current_user() + * + * @param int|null $id User ID. + * @param string $name Optional. The user's username + * @return object returns wp_set_current_user() + */ +function set_current_user($id, $name = '') { + _deprecated_function( __FUNCTION__, '3.0', 'wp_set_current_user()' ); + return wp_set_current_user($id, $name); +} +endif; + if ( !function_exists('wp_setcookie') ) : /** * Sets a cookie for a user who just logged in. This function is deprecated. diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 099262b5b..c2bb521ab 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -6,24 +6,6 @@ * @package WordPress */ -if ( !function_exists('set_current_user') ) : -/** - * Changes the current user by ID or name. - * - * Set $id to null and specify a name if you do not know a user's ID. - * - * @since 2.0.1 - * @see wp_set_current_user() An alias of wp_set_current_user() - * - * @param int|null $id User ID. - * @param string $name Optional. The user's username - * @return object returns wp_set_current_user() - */ -function set_current_user($id, $name = '') { - return wp_set_current_user($id, $name); -} -endif; - if ( !function_exists('wp_set_current_user') ) : /** * Changes the current user by ID or name. diff --git a/wp-includes/user.php b/wp-includes/user.php index 3d6a83cc2..b771c9cf4 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -478,8 +478,7 @@ function count_users($strategy = 'time') { /** * Set up global user vars. * - * Used by set_current_user() for back compat. Might be deprecated in the - * future. + * Used by wp_set_current_user() for back compat. Might be deprecated in the future. * * @since 2.0.4 * @global string $userdata User description. diff --git a/xmlrpc.php b/xmlrpc.php index f5bda44ff..6f38acfeb 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -279,7 +279,7 @@ class wp_xmlrpc_server extends IXR_Server { return false; } - set_current_user( $user->ID ); + wp_set_current_user( $user->ID ); return $user; }