CMS Made Simple API

cms_userprefs
in package

FinalYes

A static class for preferences stored with admin user accounts

Tags
license

GPL

since
1.10
author

Robert Campbell (calguy1000@gmail.com)

Table of Contents

Methods

exists()  : bool
A method to test if a preference exists for the current user
exists_for_user()  : bool
A method to test if a preference exists for a user
get()  : string
Get a user preference
get_all_for_user()  : array<string|int, mixed>
Return an array of all user preferences
get_for_user()  : string
A method to get a preference for a specific user
remove()  : mixed
A method to remove a preference for the current user
remove_for_user()  : mixed
A method to remove a method for the user
set()  : mixed
A method to set a preference for the current logged in user.
set_for_user()  : mixed
A method to set a preference for a specific user

Methods

exists()

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

public static exists(string $key) : bool
Parameters
$key : string

The preference name

Return values
bool

exists_for_user()

A method to test if a preference exists for a user

public static exists_for_user(int $userid, string $key) : bool
Parameters
$userid : int

the user id

$key : string

The preference name

Return values
bool

get()

Get a user preference

public static get(string $key[, string $dflt = '' ]) : string
Parameters
$key : string

The preference name

$dflt : string = ''

A default value if the preference could not be found

Return values
string

get_all_for_user()

Return an array of all user preferences

public static get_all_for_user(int $userid) : array<string|int, mixed>
Parameters
$userid : int
Return values
array<string|int, mixed>

Associative array of preferences and values.

get_for_user()

A method to get a preference for a specific user

public static get_for_user(int $userid, string $key[, mixed $dflt = '' ]) : string
Parameters
$userid : int

The specified user id.

$key : string

The preference name

$dflt : mixed = ''

The default value.

Return values
string

remove()

A method to remove a preference for the current user

public static remove(string $key[, bool $like = FALSE ]) : mixed
Parameters
$key : string

The preference name.

$like : bool = FALSE

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

remove_for_user()

A method to remove a method for the user

public static remove_for_user(int $userid[, string $key = '' ][, bool $like = FALSE ]) : mixed
Parameters
$userid : int

The user id

$key : string = ''

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

$like : bool = FALSE

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

set()

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

public static set(string $key, string $value) : mixed
Parameters
$key : string

The preference name

$value : string

The preference value

set_for_user()

A method to set a preference for a specific user

public static set_for_user(int $userid, string $key, string $value) : mixed
Parameters
$userid : int

The user id

$key : string

The preference name

$value : string

The preference value


        
On this page

Search results