Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The function buddylist_get_buddy_actions contains a simple flip in logic that almost doubles the load of each user's profile page when viewed by a logged in user.
There is no need to grab the viewing user's buddy list, since if the viewing user *is* a buddy already, the viewing
user's id should be in the viewed user's buddy list, since the lists are reciprocal. This should give a big boost to busy sites.
The attached patch simply flips the logic from this:
else if (in_array($viewed_user->uid, array_keys(buddylist_get_buddies($viewing_user->uid)))) {
$actions[] = theme('remove_from_buddylist_link', $viewed_user);
}
to this:
else if (in_array($viewing_user->uid, array_keys(buddylist_get_buddies($viewed_user->uid)))) {
$actions[] = theme('remove_from_buddylist_link', $viewed_user);
}
We can't for the life of us figure out why this was done in the first place, or are we missing something?
Thanks.
Comment | File | Size | Author |
---|---|---|---|
buddylist_improve_actions_performance.patch | 755 bytes | apotek |
Comments
Comment #1
apotek CreditAttribution: apotek commentedTitle edit.
Comment #2
apotek CreditAttribution: apotek commentedBouncing. Anybody there?