summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Harder2007-04-08 20:31:06 (GMT)
committer Alan Harder2007-04-08 20:31:06 (GMT)
commit8f6584c2645123f8c9684280534aa24d13f5bbe0 (patch)
treec0361a94e40757c78908bf59f7d1de50169b4a6e
parent695844f87d295b49fd7074ce56c8b2755880267b (diff)
#133281 performance improvement when buddylist in use, based on patch from gwen.
-rw-r--r--privatemsg.module11
1 files changed, 5 insertions, 6 deletions
diff --git a/privatemsg.module b/privatemsg.module
index 26f7ccc..e29a2bf 100644
--- a/privatemsg.module
+++ b/privatemsg.module
@@ -594,22 +594,21 @@ function privatemsg_new() {
$result = db_query('SELECT DISTINCT(name) AS name FROM {privatemsg} p, {users} u WHERE p.author = u.uid AND recipient = %d AND p.timestamp > (UNIX_TIMESTAMP(NOW()) - (3600 * 24 * 30)) ORDER BY name', $user->uid);
$contacts = array();
while ($name = db_fetch_object($result)) {
- $contacts[] = check_plain($name->name);
+ $username = check_plain($name->name);
+ $contacts[$username] = $username;
}
if (module_exists('buddylist')) {
$result = db_query('SELECT u.name FROM {buddylist} b, {users} u WHERE b.buddy = u.uid AND b.uid = %d', $user->uid);
while ($name = db_fetch_object($result)) {
$buddyname = check_plain($name->name);
- if (!in_array($buddyname, $contacts)) {
- $contacts[] = $buddyname;
- }
+ $contacts[$buddyname] = $buddyname;
}
- sort($contacts);
+ asort($contacts);
}
array_unshift($contacts, t('Contacts'));
$form['quick'] = array(
'#type' => 'select',
- '#options' => drupal_map_assoc($contacts),
+ '#options' => $contacts,
'#attributes' => array('style' => 'display: none;'), // hidden unless JS is working
'#suffix' => '</div>'
);