wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



setup_userdata › WordPress Function

Seit2.0.4
Veraltetn/v
setup_userdata ( $for_user_id = 0 )
Parameter:
  • (int) $for_user_id Optional. User ID to set up global data. Default 0.
    Erforderlich: Nein
    Standard:
Definiert in:
Codex:

Sets up global user vars.

Used by wp_set_current_user() for back compat. Might be deprecated in the future.


Quellcode

function setup_userdata( $for_user_id = 0 ) {
	global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_identity;

	if ( ! $for_user_id ) {
		$for_user_id = get_current_user_id();
	}
	$user = get_userdata( $for_user_id );

	if ( ! $user ) {
		$user_ID       = 0;
		$user_level    = 0;
		$userdata      = null;
		$user_login    = '';
		$user_email    = '';
		$user_url      = '';
		$user_identity = '';
		return;
	}

	$user_ID       = (int) $user->ID;
	$user_level    = (int) $user->user_level;
	$userdata      = $user;
	$user_login    = $user->user_login;
	$user_email    = $user->user_email;
	$user_url      = $user->user_url;
	$user_identity = $user->display_name;
}