USER

Common methods for handling users.

version 1
package wikindx4\core\usergroups
author Mark Grimshaw

 Methods

USER

__construct() 

Compare encrypted passwords.

checkPassword(string $username, string $pwdInput) : boolean

Return FALSE for password not found or password doesn't match. Superadmin is always id = 1

Parameters

$username

string

$pwdInput

string

Returns

boolean

Delete user(s) from user table and handle users' metadata

deleteSql(array $input) : boolean

Parameters

$input

array

Array of ids in WKX_users.

Returns

boolean

create 'added by.

displayUserAddEdit(array $row, boolean $both, string $type) : array

.., edited by... details for displaying resources

Parameters

$row

array

$both

boolean

Default is FALSE

$type

string

Default is 'resource'

Returns

array($userAdd, $userEdit)

create username

displayUserAddEditPlain(int $addId) : string

Plain version of displayUserAddEdit() used in core/modules/email/EMAIL.php for notify emails

Parameters

$addId

int

Returns

string

display user details from users table

displayUserDetails(string $form, string $hidden, int $admin) : string

If $admin != FALSE, it is the user id that an admin is editing

Parameters

$form

string

$hidden

string

$admin

int

Default is FALSE

Returns

string

set up user environment on first logon

environment(array $row, string $username) 

Parameters

$row

array

$username

string

Default is FALSE

Get users from users.

grabAll(boolean $full, boolean $useBib, string $addEdit) : mixed

Return associative array of id => group of FALSE if no users.

Parameters

$full

boolean

Default is FALSE

$useBib

boolean

Default is FALSE

$addEdit

string

Default is 'add'

Returns

mixedFALSE|array

List user's user groups

listUserGroups() : mixed

Returns

mixedFALSE|array

Load user details into session mywikindx_ array

loadSession(int $id) 

Parameters

$id

int

Default is FALSE

insert/update user preferences

writePreferences(\id $userId) 

Parameters

$userId

\id

Store user preferences in the session setup_ array

writeSessionPreferences(int $userId, string $table, boolean $upgrade) : boolean

Can come from users or config (default values for readOnly user in which case $userId = FALSE)

Parameters

$userId

int

$table

string

$upgrade

boolean

Default is FALSE

Returns

boolean

Write user details to WKX_users

writeUser(boolean $add, int $admin) : mixed

If $admin = 0, this is a standard user. If $admin = 1, this is the initial configuration/reconfiguration and we need to insert superadmin details into the database. If $admin = 2, this is an admin editing or adding a user. a) the user may not change the username from this screen. When adding a user, we need to check there is not already $username (caseless) in the database. NB - returns FALSE in case of success, an error message in case of failure.

Parameters

$add

boolean

Default is TRUE

$admin

int

Default is 0

Returns

mixed

 Properties

 

$db 
 

$errors 
 

$form 
 

$html 
 

$loadstyle 
 

$messages 
 

$session 
 

$table 
 

$template 
 

$vars