You are here

function user_import_preconfigured in User Import 5.2

1 string reference to 'user_import_preconfigured'
user_import_menu in ./user_import.module
Implementation of hook_menu().

File

./user_import.module, line 572
Import users from a comma separated file (csv).

Code

function user_import_preconfigured($template_id = NULL, $import_id = NULL, $og_id = NULL) {
  if (empty($template_id)) {
    drupal_access_denied();
  }
  $exists = db_result(db_query("SELECT COUNT(import_id) FROM {user_import} WHERE import_id = %d AND setting = 'template'", $template_id));
  if (empty($exists)) {
    drupal_access_denied();
  }
  $form = array();
  $form['template_id'] = array(
    '#type' => 'value',
    '#value' => $template_id,
  );
  $form['og_id'] = array(
    '#type' => 'value',
    '#value' => $og_id,
  );
  user_import_add_file_form($form);
  $form['next'] = array(
    '#type' => 'submit',
    '#value' => t('Import Users'),
  );

  // Set form parameters so we can accept file uploads.
  $form['#attributes'] = array(
    'enctype' => 'multipart/form-data',
  );
  if (!empty($import_id)) {

    // check access
    $exists = db_result(db_query("SELECT COUNT(import_id) FROM {user_import} WHERE import_id = %d", $import_id));
    if (!empty($exists)) {
      $form['status'] = array(
        '#value' => '<div class="user-import-report">
                          <h3>' . t('Import Report') . '</h3>' . theme('user_import_limited_list', $import_id, $template_id) . '</div>',
      );
    }
  }
  return $form;
}