LLMS_Abstract_User_Data::__get( string $key )
Magic Getter for User Data
Description Description
Mapped directly to the WP_User class.
Parameters Parameters
- $key
-
(string) (Required) key of the property to get a value for
Return Return
(mixed)
Source Source
File: includes/abstracts/llms.abstract.user.data.php
public function __get( $key ) {
// Array of items we should *not* add the $this->meta_prefix to.
$unprefixed = apply_filters(
'llms_student_unprefixed_metas',
array(
'description',
'display_name',
'first_name',
'last_name',
'nickname',
'user_login',
'user_nicename',
'user_email',
'user_registered',
'user_url',
),
$this
);
/**
* Add the meta prefix to things that aren't in the above array
* only if the meta prefix isn't already there
* this means that the following will output the same data
* $this->get( 'llms_billing_address_1')
* $this->get( 'billing_address_1')
*/
if ( false === strpos( $key, $this->meta_prefix ) && ! in_array( $key, $unprefixed ) ) {
$key = $this->meta_prefix . $key;
}
if ( ! $this->exists() ) {
return '';
}
return apply_filters( 'llms_get_student_meta_' . $key, $this->user->get( $key ), $this );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.34.0 | Allow user_url to be retrieved. |
| 3.10.1 | Unknown. |
| 3.0.0 | Introduced. |