FUEL CMS User Guide : Version 1.3.2


Fuel Users Model Class

Fuel_users_model is used for managing FUEL users in the CMS.

This class extends the Base_module_model class.

Properties Reference

Property Default Value Description
public
required
array('user_name', 'email', 'first_name', 'last_name')
User name, email, first name, and last name are required
filters
array('first_name', 'last_name', 'user_name')
Additional fields that will be searched
unique_fields
array('user_name')
User name is a unique field
has_many
array('permissions' => array
(
    [fuel] => fuel_permissions_model
)
)
Users have a "has_many" relationship with permissions

Function Reference [+]

$this->fuel->users_model->valid_user('$user', '$pwd')

Determines whether the passed user name and password are valid.

Returns

boolean

Parameters

(string) $user The user name
(string) $pwd The password

$this->fuel->users_model->valid_old_user('$user', '$pwd')

Determines whether the passed user name and password are valid for FUEL 0.93.

Returns

boolean

Parameters

(string) $user The user name
(string) $pwd The password

$this->fuel->users_model->list_items(['$limit'=NULL], ['$offset'=NULL], ['$col'='email'], ['$order'='desc'], ['$just_count'=FALSE])

Lists the user items.

Returns

mixed If $just_count is true it will return an integer value. Otherwise it will return an array of data (optional)

Parameters

(int) $limit The limit value for the list data (optional)
(int) $offset The offset value for the list data (optional)
(string) $col The field name to order by (optional)
(string) $order The sorting order (optional)
(boolean) $just_count Determines whether the result is just an integer of the number of records or an array of data (optional)

$this->fuel->users_model->user_info('$user_id')

Returns an array of the currently logged in user.

Returns

array

Parameters

(int) $user_id The user ID of the person logged in

$this->fuel->users_model->get_reset_password_token('$email')

Creates a password token for reset.

Returns

string The new token or FALSE if no user is found with the provided email address

Parameters

(string) $email The email address of the user to reset

$this->fuel->users_model->validate_reset_token('$token')

Validates that a reset token exists.

Returns

bool

Parameters

(string) $token The reset token

$this->fuel->users_model->reset_password_from_token('$email', '$token', '$password')

Resets a password given a provided email and token.

Returns

bool

Parameters

(string) $email The email address of the user
(string) $token The reset token
(string) $password The new user password

$this->fuel->users_model->generate_token()

Generates a token used for resetting your password.

Returns

string

$this->fuel->users_model->user_exists('$email')

Determines whether a user exists.

Returns

boolean

Parameters

(string) $email The email address of the user

$this->fuel->users_model->salt()

Returns a random salt value to be used with a user.

Returns

string

$this->fuel->users_model->salted_password_hash('$password', '$salt')

Returns a hash value based on the users password and salt value.

Returns

string

Parameters

(string) $password The users password
(string) $salt The users salt value

$this->fuel->users_model->options_list(['$key'='id'], ['$val'='name'], [$where=array()], ['$order'='name'])

Overwritten options list method.

Returns

array

Parameters

(string) $key The key value for the options list (optional)
(string) $val The value (lable) value for the options list (optional)
(string) $where A where condition to apply to options list data
(string) $order The order to return the options list data

$this->fuel->users_model->form_fields([$values=array()], [$related=array()])

User form fields.

Returns

array An array to be used with the Form_builder class

Parameters

(array) $values Values of the form fields (optional)
(array) $related An array of related fields. This has been deprecated in favor of using has_many and belongs to relationships (deprecated)

$this->fuel->users_model->_create_permission_fields([$params=array()])

Permissions custom field callback which returns permission checkboxes.

Returns

string

Parameters

(array) $params The parameters passed to the permissions form field

$this->fuel->users_model->on_before_clean($values)

Model hook executed right before the data is cleaned.

Returns

array Returns the values to be cleaned

Parameters

(array) $values The values to be saved right the clean method is run

$this->fuel->users_model->on_before_validate($values)

Model hook executed right before validation is run.

Returns

array Returns the values to be validated right before saving

Parameters

(array) $values The values to be saved right before validation

$this->fuel->users_model->check_password_strength('$value')

Validates that the password meets the required strength specified in the config (under Security config parameters).

Returns

bool

Parameters

(string) $value 

$this->fuel->users_model->on_before_save($values)

Model hook executed right before saving.

Returns

array Returns the values to be saved

Parameters

(array) $values The values to be saved right before saving

$this->fuel->users_model->on_after_save($values)

Model hook executed right after saving.

Returns

array Returns the values that were saved

Parameters

(array) $values The values that were just saved

$this->fuel->users_model->delete('$where')

Overwrites parent model so as you won't accidentally delete the super admin user.

Returns

void

Parameters

(mixed) $where The where condition to be applied to the delete (e.g. array('user_name' => 'darth'))

$this->fuel->users_model->is_new_email('$email')

Validation callback to check if a new user's email already exists.

Returns

boolean

Parameters

(string) $email The email address

$this->fuel->users_model->is_editable_email('$email', '$id')

Validation callback to check if an existing user's email address doen't already exist in the system.

Returns

boolean

Parameters

(string) $email The email address
(string) $id The email address

$this->fuel->users_model->_common_query(['$params'=NULL])

Overwritten: used to clear out parent base_module_model common query.

Returns

void

Parameters

(mixed) $params parameter to pass to common query (optional)


Fuel User Model Class

This class extends the Base_module_record class.

Function Reference [+]

$this->fuel->user_model->get_name()