W3cubDocs

/WordPress

WP_Customize_Manager::get_lock_user_data( int $user_id ): array|null

Gets lock user data.

Parameters

$user_idintrequired
User ID.

Return

array|null User data formatted for client.

Source

protected function get_lock_user_data( $user_id ) {
	if ( ! $user_id ) {
		return null;
	}

	$lock_user = get_userdata( $user_id );

	if ( ! $lock_user ) {
		return null;
	}

	$user_details = array(
		'id'   => $lock_user->ID,
		'name' => $lock_user->display_name,
	);

	if ( get_option( 'show_avatars' ) ) {
		$user_details['avatar'] = get_avatar_url( $lock_user->ID, array( 'size' => 128 ) );
	}

	return $user_details;
}

Changelog

Version Description
4.9.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_manager/get_lock_user_data