User Parameters

PHPR can store user specific data in a similar way to Storing Session Data. This data is stored in the database, so when the user logs back in on another computer, their session data is kept.

Most of the methods support a $user_id parameter, if left blank, the logged in user will be used.

Storing user data in a session

You can store user specific session data like so:

Phpr_User_Parameters::set('key', 'value');

Storing data for user with ID #2:

Phpr_User_Parameters::set('key', 'value', 2);

Accessing session data

Retrieving the value is just as easy:

Phpr_User_Parameters::get('key');

Or from a specific user ID #2:

Phpr_User_Parameters::get('key', 2);

You can also retrieve an item with a default value, used when the key cannot be found:

Phpr_User_Parameters::get('key', 2, 'default value');

Clearing session data

If you want to clear the session data for user ID #2:

Phpr_User_Parameters::reset(2);