Commit b4acf8e1 authored by Dan Keenan's avatar Dan Keenan

Yay happy all features done!

parent 8360b053
......@@ -94,8 +94,10 @@ function userinfo_admin_users() {
* Reduce Database overhead by getting settings all at once
*/
$settings = variable_get('userinfo_display','');
$output = '<table><thead>';
$customfields = array();
$user_info = array();
/**
* Get custom profile fields
......@@ -109,6 +111,32 @@ function userinfo_admin_users() {
'title' => $result['title'],
);
}
/**
* Number of users
*/
$num_users = db_num_rows(db_query('SELECT * FROM `{users}`'));
/**
* Default theme
*/
$default_theme = variable_get('theme_default', 'garland');
/**
* Get user info
*/
$sql = 'SELECT * FROM `{users}` WHERE `uid` >= 1';
$sql_result = db_query($sql);
for ($i = 1; $i <= db_num_rows($sql_result); $i++) {
$result = db_fetch_array($sql_result);
$user_info[$result['uid']] = $result;
}
/**
* Get data for custom profile fields
*/
$sql = 'SELECT `name` , `uid` , `value` FROM {profile_fields} INNER JOIN {profile_values} ON {profile_fields}.fid = {profile_values}.fid';
$sql_result = db_query($sql);
for ($i = 1; $i <= db_num_rows($sql_result); $i++) {
$result = db_fetch_array($sql_result);
$user_info[$result['uid']][$result['name']] = $result['value'];
}
/**
* Table Header
*
......@@ -166,8 +194,45 @@ function userinfo_admin_users() {
$output .= '<th>' . $item['title'] . '</th>';
}
}
$output .= '</thead>';
$output .= '</table>';
var_dump($customfields);
$output .= '</thead><tbody>';
/**
* Actual Info
*/
for ($i = 1; $i <= $num_users; $i++) {
if ($user_info[$i]) {
$output .= '<tr>';
foreach ($settings as $item) {
if ($item) {
/**
* Special things need to be done with date, status, and picture fields.
*/
if ($item != 'created' && $item != 'access' && $item != 'login' && $item != 'status' && $item != 'picture') {
$output .= '<td>' . $user_info[$i][$item] . '</td>';
}
else if ($item == 'created' || $item == 'access' || $item == 'login') {
$output .= '<td>' . format_date($user_info[$i][$item], 'small') . '</td>';
}
else if ($item == 'status') {
if ($user_info[$i][$item]) {
$output .= '<td>Active</td>';
}
else {
$output .= '<td>Blocked</td>';
}
}
else if ($item == 'picture') {
if ($user_info[$i][$item]) {
$output .= '<td><img src="/' . $user_info[$i][$item] . '" /></td>';
}
else {
$output .= '<td></td>';
}
}
}
}
$output .= '</tr>';
}
}
$output .= '</tbody></table>';
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