From d4a8bd587707a7c0d99b27c16164b2cb22e8c905 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 12 Aug 2004 22:03:31 +0000 Subject: - 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. --- modules/profile.module | 26 +++++++++++++++++++++++--- modules/profile/profile.module | 26 +++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/profile.module b/modules/profile.module index 07dd06720..1ad8288c7 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -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 = '
'; + while ($account = db_fetch_object($result)) { + $output .= theme('profile_profile', user_load(array('uid' => $account->uid)), $fields); + } + $output .= '
'; + $output .= theme('pager', NULL, 20); + + print theme('page', $output, t('user list')); + } } function profile_load_profile(&$user) { diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 07dd06720..1ad8288c7 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -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 = '
'; + while ($account = db_fetch_object($result)) { + $output .= theme('profile_profile', user_load(array('uid' => $account->uid)), $fields); + } + $output .= '
'; + $output .= theme('pager', NULL, 20); + + print theme('page', $output, t('user list')); + } } function profile_load_profile(&$user) { -- cgit v1.2.3