This is a module that allows you to use the $account->data in a structured way. The use case for this module would be if you need to store small amounts of data against a user that needs no UI, then this would be a good fit. Do not user $account->data as a replacement for fields.
You can then use entity meta wrappers to get or set your defined data as properties.
You define properties using a user_data_info hook:
function hook_user_data_info() {
return array(
'property_key' => array(
'label' => t('Property label'),
'type' => 'text',
),
);
}
Note: the type expects the values defined in entity_property_info definition, see http://www.drupalcontrib.org/api/drupal/contributions!entity!entity.api....
and then you can use your data like this:
$wrapper = entity_metadata_wrapper('user', $user);
$wrapper->property_key->set('text string');
or
$wrapper->property_key->value();
Project information
- Module categories: Developer Tools
- 5 sites report using this module
- Created by alexfarr on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 7.x-1.x-dev updated 5 Feb 2016 at 09:48 UTC