#
User Class Variables, Functions, and Methods
#
Variables
- **$cms->user->role
(string)** The current user role - **$cms->user->permissions
(array)** All permissions granted to current user - **$cms->user->id
(integer)** User's id if logged in, false if not logged in - For users that are logged in:
- **$cms->user->first
(string)** User's first name - **$cms->user->last
(string)** User's last name - **$cms->user->name
(string)** User's publicly visible name (defaults to first + last name) - **$cms->user->email
(string)** User's email address - **$cms->user->phone
(string)** User's phone number - **$cms->user->meta
(object)** User's meta data
- **$cms->user->first
#
Functions
- **$cms->user->can(
$permission)(boolean)** Returnstrueif user is granted$permission. - For users with
edit_userspermission:- $cms->user->create(
$email,$data) Creates a new user.$emailis required. Returns user id if successful.$dataassociative array or object with the following option parameters:firstUser's first namelastUser's last namenameUser's publicly visible name (defaults to first + last name)phoneUser's phone numberrolesUser's role. If omitted,registeredwill be the default role.permissionsAssociative array or object with anincludeandexcludeparameter. Use this exclusively to override granted/excluded permissions in the user's role.includeArray of permissions grantedexcludeArray of permissions excluded
metaAssociative array or object with custom meta data for the user in key / value pairs
- $cms->user->delete(
$id) Deletes a specific user. The current user must haveedit_userspermission for this to work. Returnstrueif successful.
- $cms->user->create(
#
Methods
- $cms->user->logout() Ends the current user's session.