Posted by ressa on December 28, 2010 at 3:39pm
3 followers
Jump to:
| Project: | Avatar Selection |
| Version: | 6.x-1.6 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
If you don't check "Enable unique avatars" people will probably tend to choose avatars from the first page. An option of sorting the avatars randomly would prevent this from happening.
Comments
#1
The avatar images that are shown to user to select are as per the weight associated with each image right now. Since the weights are static, the same order is shown to users.
To be able to provide this functionality without changing this module,
- To show different set of avatar images on the avatar selection page, if the weights associated with the avatar images are changed, then existing module will show new set of images after weights are rearranged.
- If the weights associated with the avatar images are changed randomly in a cron job by an custom add on module, then this should work.
Has anyone tried this approach?
Any interest in this functionality where users see different set of avatar images on the avatar selection page?
Thanks
#2
Hmmm this would be a nice feature to add. However, displaying avatars in a random order is a problem when the pager is enabled. This is because as they navigate through the pages of avatars, there is no way to prevent an avatar from appearing on more than one page. The main issue though is that the user would see a different set of avatars for the same page.
For example, if avatars A, B and C were displayed on page 1 of the selection widget and the user clicks onto page 2, then they might see X, B and K. They then click back to the first page, where they've just been, perhaps because they liked image A, but the first page now displays images R, L and P. See the problem?
The images are not all loaded in one go for performance reasons so AJAX is used to request the next batch. As a result we need a defined order to the image set.
However, the solution proposed by __rajeev in comment #1 would work - implement a hook_cron() in your custom module to randomly change the weights of the avatars in the avatar_selection table in the database.
#3
Here's some sample D6 code that might do the trick (untested):
function mymodule_cron() {db_query("UPDATE {avatar_selection} SET weight = FLOOR(1 + RAND() * (1000 - 1))");
}
where the random number to be returned is an integer between 1 and 1000. Assumes your custom module is called "mymodule".