Closed (fixed)
Project:
Avatar gallery
Version:
5.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Jun 2007 at 22:39 UTC
Updated:
20 May 2008 at 21:52 UTC
Jump to comment: Most recent file
Comments
Comment #1
1ns commentedAs a quick&dirty fix you can hardcode it in the SQL in avatar_gallery.module
by changing:
< $result = db_query('SELECT uid,name,picture FROM {users} WHERE status != 0 and uid != 0 ORDER BY %s', $order);
---
with:
> $result = db_query('SELECT uid,name,picture FROM {users} WHERE status != 0 and uid != 0 ORDER BY %s LIMIT %s', $order, <MAX_THUMBS_VISIBLE>);
.. where <MAX_THUMBS_VISIBLE> is the number of avatars you want displayed.
For a nontrivial selection of avatars, you could change the SQL query here as well. As the 'number of contributions' isn't a simple field in the users table, I suppose you will need some creative table joining to get the query results you want.
Comment #2
taherk commentedThanks this query worked. I am still showing blanks where the picture is default, anything that can we done to eliminate that ?
Comment #3
sdsheridanActually, there's an even more elegant way to do this, which means you don't have to hard-code anything. I just did it.
First, add this code to the avatar_gallery_admin_settings() function.
I put it right at the top, so that it shows up at the top of the form.
Secondly, in the avatar_gallery_regenerate() function, modify it as follows:
Once you do that, you can configure the number of avatars to show simply by changing the value on the settings page. I'm inherently lazy, so I hate changing code more times than I have to. :-)
I've attached my modified module in case anyone doesn't want to make the changes and just wants to use this. It has a txt extension, so just change it back to '.module' .
Comment #4
seanberto commentedGreat hack. However, when I set the max allowed value to 10, I get a "invalid argument foreach" error at line 301 when I try to regenerate the avatar. This doesn't happen when I set the max allowed value to 100 - which is more than the number of users I have in the system.
Any thoughts?
-s
Comment #5
sdsheridanVery odd. I've got mine set to 24, and it's working fine so far... but i have only 8 test users on the site at the moment. Line 301 of which module / file?
Comment #6
coupet commentedCan we submit this as a patch ?
Darly
Comment #7
sdsheridanI've been using it consistently on a site with the maximum number set to 18, and there are more than 18 members, and all is well (for me, anyway). Using Drupal 5.2, my hack to the module above, and MySQL. It is working as expected on production, test, and development instances, so... :-)
Comment #8
pfournier commentedThe user limit has been implemented in the 5.x-1.x-dev version of May 6, 2008 (n fact there is a limit in the number of rows).
Comment #9
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.