You are here

function entity_metadata_user_set_properties in Entity API 7

Callback for setting user properties.

See also

entity_metadata_user_entity_info_alter()

1 string reference to 'entity_metadata_user_set_properties'
entity_metadata_user_entity_property_info in modules/user.info.inc
Implements hook_entity_property_info() on top of user module.

File

modules/callbacks.inc, line 399
Provides various callbacks for the whole core module integration.

Code

function entity_metadata_user_set_properties($account, $name, $value) {
  switch ($name) {
    case 'roles':
      $account->roles = array_intersect_key(user_roles(), array_flip($value));
      break;
  }
}