Closed (fixed)
Project:
User Badges
Version:
5.x-1.5
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
23 Sep 2009 at 18:17 UTC
Updated:
27 Oct 2010 at 04:30 UTC
On sites that have a lot of user_load() calls the user badges modules seems to really tally up a large amount of queries due to it's loading operation in hook_user. It doesn't always make sense for users of this module to load badges on any page except the user profile page. So this patch adds a setting into user badges that allows it to be toggled on and off, essentially giving the user an option to save on precious query calls. Please review and let me know if you find anything off-mark with this. Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| user_badges_profileonly.patch | 1.58 KB | bobooon |
Comments
Comment #1
Richard Blackborder commentedI'm not sure this is the best approach because it will break any modules that need to load badges on other pages. It might be better to use Drupal's cache system (does D5 have this?) so that functionality isn't reduced, or add a hook or something so that other modules can force a load on other pages.
Comment #2
nancydruTry this one. It's based on 6.x-1.x-dev, but the code should work on 5.x. It uses simple static caching to avoid loading stuff that has already been loaded before and shouldn't break anything.
Comment #3
nancydruOops. the line
if (isset($badges[$account->uid])) {needs an extra parenthesis, as shown here.Comment #4
nancydruCommitted to 6.x-1.x-dev.