An example of how to store and retrieve complex variables in the user data column.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
user_data_example.employee_details.inc
user_data_example.info
user_data_example.module

README.md

Drupal User data - how to store user specific content without fields

All accompanying code for the tutorial available at http://www.codesidekick.com/blog/user-data-how-store-user-specific-content-without-fields.

Usage

Set data to the user object.

global $user;
$account = entity_metadata_wrapper('user', $user);
$account->employee_number->set(60000);
entity_save('user', $account);

Get data from the user object.

global $user;
$account = entity_metadata_wrapper('user', $user);
$employee_number = $account->employee_number->value();