Properties

$db_handle

$db_handle : 

Type

$id

$id : 

Type

$username

$username : 

Type

$password

$password : 

Type

$email

$email : 

Type

$first_name

$first_name : 

Type

$last_name

$last_name : 

Type

$roles_id

$roles_id : 

Type

Methods

__construct()

__construct(  $db_handle,   $username) 

Create a new User

Parameters

$db_handle
$username

populate()

populate() : true

Generate the user from the Users database.

Returns

true —

if successful, false if not

hasValidID()

hasValidID() : true

A valid ID is considered to be NOT zero.

No table can have an id of zero.

Returns

true —

if valid

doesUserExist()

doesUserExist() 

getID()

getID() : \the

Return the ID for this User

Returns

\the —

id

getUsername()

getUsername() : \the

Return the username for this User

Returns

\the —

username

getPassword()

getPassword() : \the

Return the password for this user

Returns

\the —

username

getFirstName()

getFirstName() 

getLastName()

getLastName() 

create()

create(  $password,   $email,   $first_name = "",   $last_name = "") : true

Create a new user based on parameters A new entry in the database will be created.

Based on the user name given at creation

Parameters

$password

The user's email, it is required as email may need to be sent as part of the system

// Optional profile data

$email
$first_name
$last_name

Returns

true —

if successfully created.

update()

update(  $username,   $password,   $email,   $first_name = "",   $last_name = "") : true

Update user information

Parameters

$username
$password

The user's email, it is required as email may need to be sent as part of the system

// Optional profile data

$email
$first_name
$last_name

Returns

true —

if successfully created.

assignRole()

assignRole(  $rolesId) 

Set the Role of this user by

Parameters

$rolesId

getRole()

getRole() : \the

Get the Roles id set for this user.

Returns

\the —

roles id or 0 (which means no role)

destroy()

destroy() : true

Destroy User The user will be removed from the database and all values cleared in this object.

Returns

true —

upon succesful deletion.

toString()

toString() 

Quick html output of the data of this User.

use print() to display the return value

generateDefault()

generateDefault(  $username = "") 

Parameters

$username