\User_Model

Contains current user's methods.

Summary

Methods
Properties
Constants
__construct()
get_settings()
save_settings()
get_salt()
check_login()
get_user_display_name()
regenerate_password()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct() 

Class Constructor

get_settings()

get_settings(\numeric  $user_id) : array

Returns the user settings from the database.

Parameters

\numeric $user_id

User record id of which the settings will be returned.

Returns

array —

Returns an array with user settings.

save_settings()

save_settings(array  $user) : boolean

This method saves the user settings into the database.

Parameters

array $user

Contains the current users settings.

Returns

boolean —

Returns the operation result.

get_salt()

get_salt(string  $username) : string

Retrieve user's salt from database.

Parameters

string $username

This will be used to find the user record.

Returns

string —

Returns the salt db value.

check_login()

check_login(string  $username, \type  $password) : array|null

Performs the check of the given user credentials.

Parameters

string $username

Given user's name.

\type $password

Given user's password (not hashed yet).

Returns

array|null —

Returns the session data of the logged in user or null on failure.

get_user_display_name()

get_user_display_name(\numeric  $user_id) : string

Get the given user's display name (first + last name).

Parameters

\numeric $user_id

The given user record id.

Returns

string —

Returns the user display name.

regenerate_password()

regenerate_password(string  $username, string  $email) : string|boolean

If the given arguments correspond to an existing user record, generate a new password and send it with an email.

Parameters

string $username
string $email

Returns

string|boolean —

Returns the new password on success or FALSE on failure.