Commit d4a8bd58 authored by Dries's avatar Dries

- Modified patch #9924 by njivi: added a basic member list to the profile module.  (If this deprecates the memberlist module, it ought to be deprecated.)
  I removed the permission njivi introduced and made the page title match the link title.
parent cea07eca
......@@ -27,7 +27,7 @@ function profile_menu() {
global $user;
$items = array();
$items[] = array('path' => 'profile', 'title' => t('browse'),
$items[] = array('path' => 'profile', 'title' => t('user list'),
'callback' => 'profile_browse',
'access' => TRUE,
'type' => MENU_SUGGESTED_ITEM);
......@@ -61,7 +61,7 @@ function profile_browse() {
$field = db_fetch_object(db_query("SELECT DISTINCT(fid), type, title, page FROM {profile_fields} WHERE name = '%s'", $name));
if ($field->fid) {
if ($name && $field->fid) {
// Compile a list of fields to show
$fields = array();
$result = db_query('SELECT name, title, type FROM {profile_fields} WHERE fid != %d AND visibility = %d', $field->fid, PROFILE_PUBLIC_LISTINGS);
......@@ -101,9 +101,29 @@ function profile_browse() {
print theme('page', $output, $title);
}
else {
else if ($name && !$field->id) {
drupal_not_found();
}
else {
// Compile a list of fields to show
$fields = array();
$result = db_query('SELECT name, title, type FROM {profile_fields} WHERE visibility = %d', PROFILE_PUBLIC_LISTINGS);
while ($record = db_fetch_object($result)) {
$fields[] = $record;
}
// Extract the affected users:
$result = pager_query("SELECT uid FROM {users} WHERE uid > 0 ORDER BY changed DESC", 20, 0, NULL);
$output = '<div id="profile">';
while ($account = db_fetch_object($result)) {
$output .= theme('profile_profile', user_load(array('uid' => $account->uid)), $fields);
}
$output .= '</div>';
$output .= theme('pager', NULL, 20);
print theme('page', $output, t('user list'));
}
}
function profile_load_profile(&$user) {
......
......@@ -27,7 +27,7 @@ function profile_menu() {
global $user;
$items = array();
$items[] = array('path' => 'profile', 'title' => t('browse'),
$items[] = array('path' => 'profile', 'title' => t('user list'),
'callback' => 'profile_browse',
'access' => TRUE,
'type' => MENU_SUGGESTED_ITEM);
......@@ -61,7 +61,7 @@ function profile_browse() {
$field = db_fetch_object(db_query("SELECT DISTINCT(fid), type, title, page FROM {profile_fields} WHERE name = '%s'", $name));
if ($field->fid) {
if ($name && $field->fid) {
// Compile a list of fields to show
$fields = array();
$result = db_query('SELECT name, title, type FROM {profile_fields} WHERE fid != %d AND visibility = %d', $field->fid, PROFILE_PUBLIC_LISTINGS);
......@@ -101,9 +101,29 @@ function profile_browse() {
print theme('page', $output, $title);
}
else {
else if ($name && !$field->id) {
drupal_not_found();
}
else {
// Compile a list of fields to show
$fields = array();
$result = db_query('SELECT name, title, type FROM {profile_fields} WHERE visibility = %d', PROFILE_PUBLIC_LISTINGS);
while ($record = db_fetch_object($result)) {
$fields[] = $record;
}
// Extract the affected users:
$result = pager_query("SELECT uid FROM {users} WHERE uid > 0 ORDER BY changed DESC", 20, 0, NULL);
$output = '<div id="profile">';
while ($account = db_fetch_object($result)) {
$output .= theme('profile_profile', user_load(array('uid' => $account->uid)), $fields);
}
$output .= '</div>';
$output .= theme('pager', NULL, 20);
print theme('page', $output, t('user list'));
}
}
function profile_load_profile(&$user) {
......
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