You are here

function uif_uif_validate_header in User Import Framework 7

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

Implementation of hook_uif_validate_header().

File

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

Code

function uif_uif_validate_header($header) {
  $errors = array();
  if (!in_array('mail', $header)) {
    $errors[] = t('There is no mail column in the import file.');
  }
  $labels = array();
  foreach ($header as $label) {
    if (isset($labels[$label])) {
      $errors[] = t('Repeated columns in input file are not allowed: %label', array(
        '%label' => $label,
      ));
    }
    $labels[$label] = 1;
  }
  return $errors;
}