You are here

function _user_import_profile in User Import 5

Same name and namespace in other branches
  1. 8 user_import.admin.inc \_user_import_profile()
  2. 5.2 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()
3 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_profile_string in ./user_import.module
_user_import_send_email in supported/user_import.inc

File

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

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_fields}");
    while ($row = db_fetch_object($results)) {

      // 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;
}