You are here

function _user_import_profile in User Import 8

Same name and namespace in other branches
  1. 5.2 user_import.module \_user_import_profile()
  2. 5 user_import.module \_user_import_profile()
  3. 6.4 user_import.admin.inc \_user_import_profile()
  4. 6.2 user_import.admin.inc \_user_import_profile()
  5. 7 user_import.admin.inc \_user_import_profile()
  6. 7.2 user_import.admin.inc \_user_import_profile()
2 calls to _user_import_profile()
profile_user_import_form_field_match in supported/profile.inc
Implementation of hook_user_import_form_field_match().
_user_import_send_email in supported/user_import.inc

File

./user_import.admin.inc, line 1039
Provide administration configuration pages to import users.

Code

function _user_import_profile($key = 'fid', $return_value = NULL) {
  if (!module_exists('profile')) {
    return;
  }
  static $fields_static;
  $fields = array();

  // avoid making more than one database call for profile info
  if (empty($fields_static)) {
    $results = db_query("SELECT * FROM {profile_field}");
    foreach ($results as $row) {

      // don't include private fields
      if (user_access('administer users') || $row->visibility != PROFILE_PRIVATE) {
        $fields_static[] = $row;
      }
    }
  }
  if (empty($fields_static)) {
    return array();
  }

  // return all profile fields info, or just specific type
  if (empty($return_value)) {
    foreach ($fields_static as $field) {
      $fields[$field->{$key}] = $field;
    }
  }
  else {
    foreach ($fields_static as $field) {
      $fields[$field->{$key}] = $field->{$return_value};
    }
  }
  asort($fields);
  return $fields;
}