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
.
Parameters Parameters
- $user
-
(int|null|WP_User|LLMS_Abstract_User_Data) (Optional) A
WP_User
ID, instance of aWP_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 fromget_current_user_id()
. If$user
is not empty then this parameter has no impact.Default value: true
Return Return
(void)
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 ); } }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
7.0.0 | Added $autoload parameter. |
3.9.0 | Unknown. |
2.2.3 | Introduced. |