cms_userprefs View code

A static class for preferences stored with admin user accounts

package

CMS

license

GPL

since 1.10
author

Robert Campbell (calguy1000@gmail.com)

Methods

get_for_user(integer $userid, string $key, mixed $dflt = '') : string

A method to get a preference for a specific user

static

Arguments

integer $userid

The specified user id.

string $key

The preference name

mixed $dflt

The default value.

Response

string

get(string $key, string $dflt = '') : \strung

Get a user preference

static

Arguments

string $key

The preference name

string $dflt

A default value if the preference could not be found

Response

\strung

get_all_for_user(integer $userid) : array

Return an array of all user preferences

static

Arguments

integer $userid

Response

array

Associative array of preferences and values.

exists_for_user(integer $userid, string $key) : boolean

A method to test if a preference exists for a user

static

Arguments

integer $userid

the user id

string $key

The preference name

Response

boolean

exists(string $key) : boolean

A method to test if a preference exists for the current user

static

Arguments

string $key

The preference name

Response

boolean

set_for_user(integer $userid, string $key, string $value) 

A method to set a preference for a specific user

static

Arguments

integer $userid

The user id

string $key

The preference name

string $value

The preference value

set(string $key, string $value) 

A method to set a preference for the current logged in user.

static

Arguments

string $key

The preference name

string $value

The preference value

remove_for_user(integer $userid, string $key = '', boolean $like = FALSE) 

A method to remove a method for the user

static

Arguments

integer $userid

The user id

string $key

(optional) The preference name. If not specified, all preferences for this user will be removed.

boolean $like

(optional) wether or not to use approximation in the preference name

remove(string $key, boolean $like = FALSE) 

A method to remove a preference for the current user

static

Arguments

string $key

The preference name.

boolean $like

(optional) wether or not to use approximation in the preference name