LLMS_Abstract_User_Data::__construct( int|null|WP_User|LLMS_Abstract_User_Data $user = null, boolean $autoload = true )

Constructor.


Description Description

By default, the current user is loaded if no $user is supplied. This behavior can be disabled by providing $autoload = false.


Top ↑

Parameters Parameters

$user

(int|null|WP_User|LLMS_Abstract_User_Data) (Optional) A WP_User ID, instance of a WP_User, or instance of any class extending this class.

Default value: null

$autoload

(boolean) (Optional) If true and $user input is empty, the user will be loaded from get_current_user_id(). If $user is not empty then this parameter has no impact.

Default value: true


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/abstracts/llms.abstract.user.data.php

	public function __construct( $user = null, $autoload = true ) {

		$user = ( $user || $autoload ) ? $this->get_user_id( $user ) : false;
		if ( false !== $user ) {
			$this->id   = $user;
			$this->user = get_user_by( 'ID', $user );
		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Added $autoload parameter.
3.9.0 Unknown.
2.2.3 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.