Commit 8360b053 authored by Dan Keenan's avatar Dan Keenan

Initial work on User Info display. Headers done.

parent 7be46ece
......@@ -17,6 +17,9 @@
function userinfo_menu($may_cache) {
$items = array();
if (!$may_cache) {
/**
* Actual Info View
*/
$items[] = array(
'path' => 'admin/user/userinfo',
'title' => t('User Info'),
......@@ -24,6 +27,9 @@ function userinfo_menu($may_cache) {
'callback' => 'userinfo_admin_users',
'access' => user_access('administer users'),
);
/**
* Configuration
*/
$items[] = array(
'path' => 'admin/settings/userinfo',
'title' => t('User Info'),
......@@ -74,4 +80,94 @@ function userinfo_admin_settings() {
$form['userinfo_display']['#options'][$result['name']] = $result['title'];
}
return system_settings_form($form);
}
/**
* Define the info page
*
* @return Info on users based on the settings form
*
* @see userinfo_admin_settings()
*/
function userinfo_admin_users() {
/**
* Reduce Database overhead by getting settings all at once
*/
$settings = variable_get('userinfo_display','');
$output = '<table><thead>';
$customfields = array();
/**
* Get custom profile fields
*/
$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);
$customfields[] = array(
'name' => $result['name'],
'title' => $result['title'],
);
}
/**
* Table Header
*
* Generated by going through each item in the settings page
* and checking to se if it is enabled. If it is, then output
* the value of the item and move on.
*
* @see userinfo_admin_settings()
*/
foreach ($settings as $item) {
if ($item) {
if ($item == 'uid') {
$output .= '<th>UID</th>';
}
else if ($item == 'name') {
$output .= '<th>Username</th>';
}
else if ($item == 'mail') {
$output .= '<th>Email</th>';
}
else if ($item == 'theme') {
$output .= '<th>Theme</th>';
}
else if ($item == 'signature') {
$output .= '<th>Signature</th>';
}
else if ($item == 'created') {
$output .= '<th>Created</th>';
}
else if ($item == 'access') {
$output .= '<th>Last accessed</th>';
}
else if ($item == 'login') {
$output .= '<th>Last login</th>';
}
else if ($item == 'status') {
$output .= '<th>Status</th>';
}
else if ($item == 'timezone') {
$output .= '<th>Timezone</th>';
}
else if ($item == 'language') {
$output .= '<th>Language</th>';
}
else if ($item == 'picture') {
$output .= '<th>Picture</th>';
}
else if ($item == 'init') {
$output .= '<th>Sign-up email</th>';
}
}
}
foreach ($customfields as $item) {
if ($settings[$item['name']]) {
$output .= '<th>' . $item['title'] . '</th>';
}
}
$output .= '</thead>';
$output .= '</table>';
var_dump($customfields);
return $output;
}
\ 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