You are here

function uc_importer_admin_settings_validate in Ubercart 5

Validation handler for uc_importer_admin_settings().

Allow only existing users to be authors of imported nodes.

File

uc_importer/uc_importer.module, line 140
XML product importer and exporter.

Code

function uc_importer_admin_settings_validate($form_id, $form_values) {
  if (!empty($form_values['uc_importer_user']) && !($account = user_load(array(
    'name' => $form_values['uc_importer_user'],
  )))) {

    // The use of empty() is mandatory in the context of usernames
    // as the empty string denotes the anonymous user. In case we
    // are dealing with an anonymous user we set the user ID to 0.
    form_set_error('uc_importer_user', t('The username %name does not exist.', array(
      '%name' => $form_values['uc_importer_user'],
    )));
  }
}