PHP Class WPAS_Member

Since: 3.3
Afficher le fichier Open project: awesome-support/awesome-support Class Usage Examples

Méthodes publiques

Свойство Type Description
$caps array User capabilities
$data array User profile data
$is_member boolean Whether or not the user requested is a member of Awesome Support
$roles array User roles
$user_id integer User ID

Méthodes publiques

Méthode Description
__construct ( integer | stdClass $user ) WPAS_Member constructor.
has_cap ( string $cap ) : boolean Check if the user has a specific capability
is_member ( ) : boolean Check if the current user actually is an Awesome Support member

Méthodes protégées

Méthode Description
data_defaults ( ) : array Get the default profile data fields
get_user_data ( $user_id ) : array Get user data by user ID
init ( $data ) : void Setup the user data
setup_caps ( ) : void Setup the user capabilities based on their roles
setup_roles ( ) : void Setup the user roles

Method Details

__construct() public méthode

WPAS_Member constructor.
public __construct ( integer | stdClass $user )
$user integer | stdClass The user ID or stdClass

data_defaults() protected méthode

This is also used as a whitelist. Only fields listed in the defaults will be actually used as the user $data
Since: 3.3
protected data_defaults ( ) : array
Résultat array

get_user_data() protected méthode

Get user data by user ID
Since: 3.3
protected get_user_data ( $user_id ) : array
$user_id
Résultat array

has_cap() public méthode

Check if the user has a specific capability
Since: 3.3
public has_cap ( string $cap ) : boolean
$cap string Capability to check
Résultat boolean

init() protected méthode

Setup the user data
Since: 3.3
protected init ( $data ) : void
$data
Résultat void

is_member() public méthode

Check if the current user actually is an Awesome Support member
Since: 3.3
public is_member ( ) : boolean
Résultat boolean

setup_caps() protected méthode

This method is mostly based on WordPress' WP_User::get_role_caps()
Since: 3.3
protected setup_caps ( ) : void
Résultat void

setup_roles() protected méthode

Setup the user roles
Since: 3.3
protected setup_roles ( ) : void
Résultat void

Property Details

$caps public_oe property

User capabilities
Since: 3.3
public array $caps
Résultat array

$data public_oe property

User profile data
Since: 3.3
public array $data
Résultat array

$is_member public_oe property

Whether or not the user requested is a member of Awesome Support
Since: 3.3
public bool $is_member
Résultat boolean

$roles public_oe property

User roles
Since: 3.3
public array $roles
Résultat array

$user_id public_oe property

User ID
Since: 3.3
public int $user_id
Résultat integer