You are here

function _profile_get_fields in Drupal 6

Same name and namespace in other branches
  1. 5 modules/profile/profile.module \_profile_get_fields()
  2. 7 modules/profile/profile.module \_profile_get_fields()
3 calls to _profile_get_fields()
profile_form_profile in modules/profile/profile.module
profile_save_profile in modules/profile/profile.module
profile_validate_profile in modules/profile/profile.module

File

modules/profile/profile.module, line 558
Support for configurable user profiles.

Code

function _profile_get_fields($category, $register = FALSE) {
  $args = array();
  $sql = 'SELECT * FROM {profile_fields} WHERE ';
  $filters = array();
  if ($register) {
    $filters[] = 'register = 1';
  }
  else {

    // Use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues.
    $filters[] = "LOWER(category) = LOWER('%s')";
    $args[] = $category;
  }
  if (!user_access('administer users')) {
    $filters[] = 'visibility != %d';
    $args[] = PROFILE_HIDDEN;
  }
  $sql .= implode(' AND ', $filters);
  $sql .= ' ORDER BY category, weight';
  return db_query($sql, $args);
}