diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-03-14 23:01:38 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-03-14 23:01:38 +0000 |
commit | 3b3050959952ceae617b59246f364f4b0edd2dcd (patch) | |
tree | b7cc39b97156ee0f346334d1e8dd78b5662c40e7 /modules/profile/profile.pages.inc | |
parent | 8a0d326a8e134ad4261b9575ce073f9e44b72f60 (diff) | |
download | brdo-3b3050959952ceae617b59246f364f4b0edd2dcd.tar.gz brdo-3b3050959952ceae617b59246f364f4b0edd2dcd.tar.bz2 |
#347250 by catch, drewish, and Berdir: Add function for loading multiple users in one request.
Diffstat (limited to 'modules/profile/profile.pages.inc')
-rw-r--r-- | modules/profile/profile.pages.inc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/modules/profile/profile.pages.inc b/modules/profile/profile.pages.inc index 9cb761a28..e1e01d9e0 100644 --- a/modules/profile/profile.pages.inc +++ b/modules/profile/profile.pages.inc @@ -55,11 +55,13 @@ function profile_browse() { } // Extract the affected users: - $result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_value} v ON u.uid = v.uid WHERE v.fid = %d AND $query AND u.access != 0 AND u.status != 0 ORDER BY u.access DESC", 20, 0, NULL, $arguments); + $result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_value} v ON u.uid = v.uid WHERE v.fid = %d AND $query AND u.access != 0 AND u.status != 0 ORDER BY u.access DESC", 20, 0, NULL, $arguments)->fetchAllAssoc('uid'); + + // Load the users. + $users = user_load_multiple(array_keys($result)); $content = ''; - while ($account = db_fetch_object($result)) { - $account = user_load(array('uid' => $account->uid)); + foreach ($users as $account) { $profile = _profile_update_user_fields($fields, $account); $content .= theme('profile_listing', $account, $profile); } @@ -88,11 +90,10 @@ function profile_browse() { } // Extract the affected users: - $result = pager_query('SELECT uid, access FROM {users} WHERE uid > 0 AND status != 0 AND access != 0 ORDER BY access DESC', 20, 0, NULL); - + $result = pager_query('SELECT uid, access FROM {users} WHERE uid > 0 AND status != 0 AND access != 0 ORDER BY access DESC', 20, 0, NULL)->fetchAllAssoc('uid'); + $users = user_load_multiple(array_keys($result)); $content = ''; - while ($account = db_fetch_object($result)) { - $account = user_load(array('uid' => $account->uid)); + foreach ($users as $account) { $profile = _profile_update_user_fields($fields, $account); $content .= theme('profile_listing', $account, $profile); } |