WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

setup_userdata() WP 2.0.4

Set up global user vars.

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

Хуков нет.

Возвращает

Null. Ничего.

Использование

setup_userdata( $for_user_id );
$for_user_id(число)
User ID to set up global data.
По умолчанию: 0

Заметки

  • Global. Строка. $user_login The user username for logging in
  • Global. WP_User. $userdata User data.
  • Global. Число. $user_level The level of the user
  • Global. Число. $user_ID The ID of the user
  • Global. Строка. $user_email The email address of the user
  • Global. Строка. $user_url The url in the user's profile
  • Global. Строка. $user_identity The display name of the user

Список изменений

С версии 2.0.4 Введена.

Код setup userdata: wp-includes/user.php WP 5.2.4

<?php
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;
}