You are here

function theme_uif_preview_one_user in User Import Framework 7

Same name and namespace in other branches
  1. 6 uif.admin.inc \theme_uif_preview_one_user()

Theme preview of a single user.

1 theme call to theme_uif_preview_one_user()
theme_uif_preview_users in ./uif.admin.inc
Theme preview of all users.

File

./uif.admin.inc, line 397
Simple, extensible user import from a CSV file.

Code

function theme_uif_preview_one_user($variables) {
  $user_data = $variables['data'];
  $rows = array();
  foreach ($user_data as $field => $value) {
    $rows[] = array(
      $field,
      $value,
    );
  }
  $args = array(
    ':mail' => db_like($user_data['mail']),
  );
  $user_exists = db_query('SELECT COUNT(*) FROM {users} WHERE mail LIKE :mail', $args)
    ->fetchField();
  $annotation = $user_exists ? t('update') : t('create');
  $heading = $user_data['mail'] . ' (' . $annotation . ')';
  return '<h3>' . $heading . '</h3>' . theme('table', array(
    'rows' => $rows,
  ));
}