OpenWebPresence User Support Library

package OwpUsers

 Methods

Constructor

__construct() 
method
access public
author Brian Tafoya
version 1.0

Debug

__debugInfo() 
method
access public
uses
uses
uses
author Brian Tafoya
version 1.0

addUser

addUser(array $data_array) : integer
method Create a user record
access public
author Brian Tafoya
version 1.0

Parameters

$data_array

array

User array used to create the user's record. ("email", "passwd", "first_name", "last_name", "statusID", "welcome_email_sent", "uuid")

Exceptions

\InvalidArgumentException Thrown when the provided argument is not valid user data, code 20
\Exception Thrown on standard failures, code 10, UDF failures code 30

Returns

integeruserID

clearLostPassUUID

clearLostPassUUID(integer $userID, integer $statusID) : boolean
method Reset the lost pass UUID and set the statusID, for example when a lost password request has been completed
access public
author Brian Tafoya
version 1.0

Parameters

$userID

integer

Existing userID

$statusID

integer

New user statusID

Returns

boolean

deleteUser

deleteUser(integer $userID) : boolean
method Permanently remove a user record.
access public
author Brian Tafoya
version 1.0

Parameters

$userID

integer

Existing userID

Exceptions

\Exception Thrown on UDF failures code 30

Returns

booleanSuccess or failure

genPasswdHash

genPasswdHash(string $password) : string
method Generate a password hash
access public
author Brian Tafoya
version 1.0

Parameters

$password

string

User's password

Returns

stringHashed password

getUserIDViaLostPassUUID

getUserIDViaLostPassUUID(string $reset_pass_uuid) : integer
method Get the userID via the lost UUID token, previously set by setLostPassUUID()
access public
see
author Brian Tafoya
version 1.0

Parameters

$reset_pass_uuid

string

UUID token usually sent via email for validation

Returns

integer

getUserRecord

getUserRecord(integer $userID) : mixed
Static
method Get user record.
access public
author Brian Tafoya
version 1.0

Parameters

$userID

integer

UserID

Returns

mixed

get_user_record_byEMAIL

get_user_record_byEMAIL(string $email) : mixed
method Retrieve a user's data (with meta) based on email, without setting a session
access public
author Brian Tafoya
version 1.0

Parameters

$email

string

The string Existing Email

Returns

mixedUser array or false on failure

get_user_record_byID

get_user_record_byID(integer $userID) : mixed
method Retrieve a user's data (with meta) based on userID, without setting a session
access public
author Brian Tafoya
version 1.0

Parameters

$userID

integer

The string Existing userID

Returns

mixedUser array or false on failure

get_user_record_byID_noMeta

get_user_record_byID_noMeta(integer $userID) : array
method Retrieve base user data without any meta data by userID
access public
uses
author Brian Tafoya
version 1.0

Parameters

$userID

integer

Existing userID

Returns

arrayUser array, false of failure

get_user_record_byUUID_noMeta

get_user_record_byUUID_noMeta(string $uuid) : array
method Retrieve base user data without any meta data by uuid
access public
uses
author Brian Tafoya
version 1.0

Parameters

$uuid

string

Existing UUID

Returns

arrayUser array, false of failure

get_user_record_noMeta

get_user_record_noMeta(string $where_clause) : array
method Retrieve base user data without any meta data by WHERE statement
access public
author Brian Tafoya
version 1.0

Parameters

$where_clause

string

The string WHERE statement used in tbl_users select

Returns

arrayUser array, false of failure

isAdmin

isAdmin() : boolean
Static
method Returns true if the user is flagged as an admin
access public
author Brian Tafoya
version 1.0

Returns

boolean

isLoggedIn

isLoggedIn() : boolean
Static
method Returns true if a valid user session exists
access public
author Brian Tafoya
version 1.0

Returns

boolean

logOut

logOut() : boolean
method Log the user out, clearing the user session
access public
author Brian Tafoya
version 1.0

Exceptions

\Exception Thrown on UDF failures code 30

Returns

boolean

refresh_user_session

refresh_user_session() : boolean
method Refresh the session data from the user's record
access public
author Brian Tafoya
version 1.0

Exceptions

\Exception On refresh

Returns

boolean

rememberMe

rememberMe() : boolean
method Load the user's profile based on the remember me cookie if the hash matches
access public
author Brian Tafoya
version 1.0

Returns

boolean

rememberMeSet

rememberMeSet() : boolean
method Set the remember me cookie
access public
author Brian Tafoya
version 1.0

Returns

boolean

sanityCheck

sanityCheck(string $redirect_url = ""
method Validate that the user session still exists, if not redirect them
access public
author Brian Tafoya
version 1.0

Parameters

$redirect_url

string

(optional) URL to redirect to should the user sanity check show the user is not logged in

saveUserMetaDataItem

saveUserMetaDataItem($userID, $key_name, $key_value) : boolean
method Set user meta data
access public
author Brian Tafoya
version 1.0

Parameters

$userID

$key_name

$key_value

Returns

boolean

setLostPassUUID

setLostPassUUID(integer $userID) : array
method Create a lost password recovery UUID token
access public
see
see
author Brian Tafoya
version 1.0

Parameters

$userID

integer

Existing userID

Returns

array

setLostPassUUIDViaEmail

setLostPassUUIDViaEmail(string $email) : string
method Create a lost password recovery UUID token
access public
see
see
author Brian Tafoya
version 1.0

Parameters

$email

string

Existing user email

Returns

string

setStatusID

setStatusID(integer $userID, integer $statusID) 
method Set the user status ID
access public
see
author Brian Tafoya
version 1.0

Parameters

$userID

integer

Existing userID

$statusID

integer

Existing valid statusID

Exceptions

\Exception Thrown on UDF failures code 30

setStatusIdWhereInList

setStatusIdWhereInList(integer $userID, integer $statusID, string $statusIDList) 
method Set the user status ID
access public
see
author Brian Tafoya
version 1.0

Parameters

$userID

integer

Existing userID

$statusID

integer

Existing valid statusID

$statusIDList

string

Exceptions

\Exception Thrown on UDF failures code 30

updateLoginCount

updateLoginCount(integer $userID) 
method Updating the login counter as well as the user's current IP address
access public
author Brian Tafoya
version 1.0

Parameters

$userID

integer

Existing userID

updateLostPassword

updateLostPassword(string $password, string $uuid) : boolean
method Usually used in conjunction with getUserIDViaLostPassUUID() and setLostPassUUID() for lost passwords or to the user to updated their own passwrd
access public
see
see
author Brian Tafoya
version 1.0

Parameters

$password

string

New user password

$uuid

string

Lost Pass UUID

Exceptions

\Exception Thrown on UDF failures code 30

Returns

boolean

updatePassword

updatePassword(string $password, integer $userID) : boolean
method Usually used in conjunction with getUserIDViaLostPassUUID() and setLostPassUUID() for lost passwords or to the user to updated their own passwrd
access public
see
see
author Brian Tafoya
version 1.0

Parameters

$password

string

New user password

$userID

integer

Existing userID

Exceptions

\Exception Thrown on UDF failures code 30

Returns

boolean

updateUser

updateUser(integer $userID, array $data_array) : boolean
method Update an existing user record
access public
author Brian Tafoya
version 1.0

Parameters

$userID

integer

Existing userID

$data_array

array

New user data

Exceptions

\InvalidArgumentException Provided argument is now valid userID
\Exception

Returns

boolean

updateUserAdminRights

updateUserAdminRights(integer $userID, integer $is_admin = 0, integer $hide_ads = 0, integer $is_dev = 0
method Updating the login counter as well as the user's current IP address
access public
author Brian Tafoya
version 1.0

Parameters

$userID

integer

New or Existing userID

$is_admin

integer

(optional) Designate as an admin

$hide_ads

integer

(optional) Hide ads

$is_dev

integer

(optional) Enable dev features

userData

userData() : mixed
Static
method Get user data for the logged in user
access public
author Brian Tafoya
version 1.0

Returns

mixedUser data array or false if it fails

userDataItem

userDataItem(string $item, string $alternate_data = "", string $append_to_item = "") : mixed
Static
method Get a user data item for the logged in user
access public
author Brian Tafoya
version 1.0

Parameters

$item

string

User data item column name

$alternate_data

string

String info as an alternative to the userDataItem when it does not exist

$append_to_item

string

String info to append to the userDataItem

Returns

mixeduserData

userExistsViaEmail

userExistsViaEmail(string $email) : boolean
method Check if user exists via email
access public
author Brian Tafoya
version 1.0

Parameters

$email

string

Valid user email address

Returns

boolean

userID

userID() : integer
Static
method Return the current userID
access public
author Brian Tafoya
version 1.0

Returns

integeruserID

userLogin

userLogin(string $email, string $passwd) : boolean
method User login via email and password
access public
author Brian Tafoya
version 1.0

Parameters

$email

string

Valid user email address

$passwd

string

Valid user password

Exceptions

\OwpUserException User status information

Returns

boolean

userLoginViaToken

userLoginViaToken(string $uuid) : boolean
method User login via UUID token
access public
author Brian Tafoya
version 1.0

Parameters

$uuid

string

User UUID token created with the record, not related to the lost password UUID

Exceptions

\OwpUserException User status information

Returns

boolean

userLoginViaUserID

userLoginViaUserID(integer $userID) : boolean
method User login via UserID
access public
author Brian Tafoya
version 1.0

Parameters

$userID

integer

Existing userID

Exceptions

\OwpUserException User status information

Returns

boolean

validateStatusID

validateStatusID(integer $statusID) : boolean
method
access public
see
author Brian Tafoya
version 1.0

Parameters

$statusID

integer

status ID to validate

Returns

boolean

validateUserPassword

validateUserPassword(integer $userID, string $passwd) : boolean
method Validate user password via userID
access public
author Brian Tafoya
version 1.0

Parameters

$userID

integer

Valid userID

$passwd

string

Valid user password

Returns

boolean

userLoginCore

userLoginCore(string $where_statement) : boolean
method The core query method
access private
author Brian Tafoya
version 1.0

Parameters

$where_statement

string

Where statement to be using within the user row query

Exceptions

\OwpUserException OwpUserException custom status handling

Returns

boolean

validate_password

validate_password(string $passwd, string $hash) : mixed
method Validate the passed password against the user hash supplied
access private
author Brian Tafoya
version 1.0

Parameters

$passwd

string

Valid user password

$hash

string

Existing user hash for user record

Returns

mixed

 Properties

 

DB object.

$OwpDBMySQLi : object

Default

 

PhpConsole object.

$PhpConsole : object

Default

 

Error array

$errors : array

Default

false
 

Requested action.

$requested_action : string

Default

 

Set the root file path.

$root_path : string

Default

 

OpenWebPresence support methods

$userID : integer

Default

0
 

Set the root file path.

$uuid : string

Default

 

SqueakyMindsPhpHelper support methods

$SqueakyMindsPhpHelper : object

Default

 

The web root url

$current_web_root : string

Default

 

ezSQL Database Object

$ezSqlDB : object

Default

 

OpenWebPresence support methods

$owp_SupportMethods : object

Default