Properties

$id

$id : integer

Type

integer — The user id

$username

$username : string

Type

string — The user username

$email

$email : string

Type

string — The user email address

$first_link_done

$first_link_done : boolean

Type

boolean — True if the user linked his streaming platform account(s) at least once, false otherwise

$reset_pwd_token

$reset_pwd_token : string

Type

string — Reset password token

$reset_pwd_token_endat

$reset_pwd_token_endat : string

Type

string — Reset password token expiration datetime

$platform_accounts

$platform_accounts : array

Type

array — All the streaming platforms accounts the user linked with his vigas account

Methods

logUserLogin()

logUserLogin(\Vigas\Application\Model\PDO  $db) 

Logs the datetime into the database when a user just logged in

Parameters

\Vigas\Application\Model\PDO $db

Database connection object

getUser()

getUser(\Vigas\Application\Model\PDO  $db, array  $conditions, string  $password = null) : boolean

Gets user from the database and set User object properties

Parameters

\Vigas\Application\Model\PDO $db

database connection object

array $conditions

The SQL condition(s) to select the user

string $password

The user password

Returns

boolean —

Returns false if user has not been found

insertUser()

insertUser(\Vigas\Application\Model\PDO  $db, string  $username, string  $email, string  $password) : boolean

Inserts a new user account into the database

Parameters

\Vigas\Application\Model\PDO $db

Database connection object

string $username

The user username

string $email

The user email address

string $password

The user password

Returns

boolean —

Returns true if account has been created, false otherwise

updatePassword()

updatePassword(\Vigas\Application\Model\PDO  $db, array  $conditions, string  $new_password) : boolean

Changes a user password

Parameters

\Vigas\Application\Model\PDO $db

Database connection object

array $conditions

The SQL condition(s) to select the user

string $new_password

The new user password

Returns

boolean —

Returns true if the password has been changed, false otherwise

deleteResetPwdToken()

deleteResetPwdToken(\Vigas\Application\Model\PDO  $db, integer  $id) : boolean

Deletes the reset password token after the user set up a new password

Parameters

\Vigas\Application\Model\PDO $db

Database connection object

integer $id

The user id

Returns

boolean —

Returns true if reset_pwd_token and reset_pwd_token_endat columns has been set to NULL, false otherwise

checkUniqueUsername()

checkUniqueUsername(\Vigas\Application\Model\PDO  $db, string  $username) : boolean

Checks if an account already exist with the given username

Parameters

\Vigas\Application\Model\PDO $db

Database connection object

string $username

The username address to check

Returns

boolean —

Returns true if the username is unique (not found in database), false otherwise

checkUniqueEmail()

checkUniqueEmail(\Vigas\Application\Model\PDO  $db, string  $email) : boolean

Checks if an account already exist with the given email address

Parameters

\Vigas\Application\Model\PDO $db

Database connection object

string $email

The email address to check

Returns

boolean —

Returns true if the email address is unique (not found in database), false otherwise

firstLinkDone()

firstLinkDone(\Vigas\Application\Model\PDO  $db, integer  $id) : boolean

Sets first_link_done column to true

Parameters

\Vigas\Application\Model\PDO $db

Database connection object

integer $id

The user id

Returns

boolean —

Returns true if first_link_done has been set to true, false otherwise

saveResetPwdToken()

saveResetPwdToken(\Vigas\Application\Model\PDO  $db, string  $token, integer  $id) : boolean

Saves reset password token and reset password token expiration datetime into database

Parameters

\Vigas\Application\Model\PDO $db

Database connection object

string $token

The reset password token

integer $id

The user id

Returns

boolean —

returns true if reset password token and reset password token expiration datetime has been saved, false otherwise

addPlatformAccounts()

addPlatformAccounts(\Vigas\Application\Model\Platform  $account) 

Adds a streaming platform account into array $platform_accounts

Parameters

\Vigas\Application\Model\Platform $account

The streaming platform account to add

getId()

getId() : integer

Returns

integer —

The user id

getUsername()

getUsername() : string

Returns

string —

The user username

getEmail()

getEmail() : string

Returns

string —

The user email address

getFirstLinkDone()

getFirstLinkDone() : boolean

Returns

boolean —

True if the user linked his streaming platform account(s) at least once, false otherwise

getResetPwdToken()

getResetPwdToken() : string

Returns

string —

Reset password token

getResetPwdTokenEndat()

getResetPwdTokenEndat() : string

Returns

string —

Reset password token expiration datetime

getPlatformAccounts()

getPlatformAccounts() : array

Returns

array —

All the streaming platforms accounts the user linked with his vigas account

builRequestConditions()

builRequestConditions(array  $conditions) : array

Builds an array of SQL query WHERE condition(s)

Parameters

array $conditions

The SQL query WHERE condition(s)

Returns

array —

An array containing condition(s) as a string and an array of value(s)