Commit 7be46ece authored by Dan Keenan's avatar Dan Keenan

Settings form done

parents
; $Id$
name = User Info
description = Provides an easy way to view all information about users.
package = User management
version = "$Name$"
\ No newline at end of file
<?php
// $Id$
/**
* @file
* Provides an easy way to view all information about users.
*
* Allows Site Adminstrators (Users with the "Administer Users"
* permission view lots of information about registered users.
*/
/**
* Implementation of hook_menu().
*
* @return Array of menu items
*/
function userinfo_menu($may_cache) {
$items = array();
if (!$may_cache) {
$items[] = array(
'path' => 'admin/user/userinfo',
'title' => t('User Info'),
'description' => t('Show info on all users'),
'callback' => 'userinfo_admin_users',
'access' => user_access('administer users'),
);
$items[] = array(
'path' => 'admin/settings/userinfo',
'title' => t('User Info'),
'description' => t('Configure how much User Info is displayed'),
'callback' => 'drupal_get_form',
'callback arguments' => array('userinfo_admin_settings'),
'access' => user_access('administer site configuration'),
);
}
return $items;
}
/**
* Define the settings form.
*
* @return The form's settings to be rendered by Drupal
*
* @see hook_forms()
*/
function userinfo_admin_settings() {
$form['userinfo_display'] = array(
'#type' => 'checkboxes',
'#title' => t('Info to display'),
'#options' => array(
'uid' => 'UID',
'name' => 'Username',
'mail' => 'Email address',
'theme' => 'Chosen theme',
'signature' => 'Signature',
'created' => 'Date created',
'access' => 'Date last accessed',
'login' => 'Date of last login',
'status' => 'Blocked/Unblocked',
'timezone' => 'Timezone',
'language' => 'Language',
'picture' => 'Picture',
'init' => 'Signup email address',
),
'#default_value' => variable_get('userinfo_display', array('uid', 'name', 'mail', 'status',)),
);
/**
* Get custom profile fields and append them to the list
*/
$sql = 'SELECT DISTINCT `title`, `name` FROM `{profile_fields}`';
$sql_result = db_query($sql);
for ($i = 1; $i <= db_num_rows($sql_result); $i++) {
$result = db_fetch_array($sql_result);
$form['userinfo_display']['#options'][$result['name']] = $result['title'];
}
return system_settings_form($form);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment