You are here

function user_uuid_entity_features_rebuild_alter in UUID Features Integration 7

Implements hook_uuid_entity_features_rebuild_alter().

File

includes/modules/user.inc, line 33
uuid features hooks on behalf of the user collection module.

Code

function user_uuid_entity_features_rebuild_alter($entity_type, $entity, $data, $module) {
  if (isset($entity->user_uuid) && uuid_is_valid($entity->user_uuid)) {
    $uids = entity_get_id_by_uuid('user', array(
      $entity->user_uuid,
    ));
    $uid = reset($uids);
    if ($uid) {
      $entity->uid = $uid;
    }
    else {
      $entity->uid = 1;
    }
  }
  elseif (in_array($entity_type, array(
    'node',
    'file',
  ))) {
    $entity->uid = 1;
  }
}