function _profile_get_fields

7.x profile.module _profile_get_fields($category, $register = FALSE)
6.x profile.module _profile_get_fields($category, $register = FALSE)
3 calls to _profile_get_fields()
profile_form_profile in drupal-6.x/modules/profile/profile.module
profile_save_profile in drupal-6.x/modules/profile/profile.module
profile_validate_profile in drupal-6.x/modules/profile/profile.module

File

drupal-6.x/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);
}