You are here

function profile_admin_overview in Drupal 5

Same name and namespace in other branches
  1. 4 modules/profile.module \profile_admin_overview()
  2. 6 modules/profile/profile.admin.inc \profile_admin_overview()
  3. 7 modules/profile/profile.admin.inc \profile_admin_overview()

Menu callback; display a listing of all editable profile fields.

1 string reference to 'profile_admin_overview'
profile_menu in modules/profile/profile.module
Implementation of hook_menu().

File

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

Code

function profile_admin_overview() {
  $result = db_query('SELECT title, name, type, category, fid FROM {profile_fields} ORDER BY category, weight');
  $rows = array();
  while ($field = db_fetch_object($result)) {
    $rows[] = array(
      check_plain($field->title),
      check_plain($field->name),
      _profile_field_types($field->type),
      check_plain($field->category),
      l(t('edit'), "admin/user/profile/edit/{$field->fid}"),
      l(t('delete'), "admin/user/profile/delete/{$field->fid}"),
    );
  }
  if (count($rows) == 0) {
    $rows[] = array(
      array(
        'data' => t('No fields defined.'),
        'colspan' => '6',
      ),
    );
  }
  $header = array(
    t('Title'),
    t('Name'),
    t('Type'),
    t('Category'),
    array(
      'data' => t('Operations'),
      'colspan' => '2',
    ),
  );
  $output = theme('table', $header, $rows);
  $output .= '<h2>' . t('Add new field') . '</h2>';
  $output .= '<ul>';
  foreach (_profile_field_types() as $key => $value) {
    $output .= '<li>' . l($value, "admin/user/profile/add/{$key}") . '</li>';
  }
  $output .= '</ul>';
  return $output;
}