Advertisements

setup_userdata

Definition:
function setup_userdata($for_user_id = '') {}

Set up global user vars.
Used by wp_set_current_user() for back compat. Might be deprecated in the future.

Parameters

  • int $for_user_id: Optional. User ID to set up global data.

Source code

function setup_userdata($for_user_id = '') {

	global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity;



	if ( '' == $for_user_id )

		$user = wp_get_current_user();

	else

		$user = new WP_User($for_user_id);



	$userdata   = $user->data;

	$user_ID    = (int) $user->ID;

	$user_level = (int) isset($user->user_level) ? $user->user_level : 0;



	if ( 0 == $user->ID ) {

		$user_login = $user_email = $user_url = $user_pass_md5 = $user_identity = '';

		return;

	}



	$user_login	= $user->user_login;

	$user_email	= $user->user_email;

	$user_url	= $user->user_url;

	$user_pass_md5	= md5($user->user_pass);

	$user_identity	= $user->display_name;

}

2839

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: