Hi, I meet a problem when I use this module.
In my site, there are 6 roles for user. So, if the current login user has many roles, and when I upload a picture by "admin/settings/avatar_selection/upload", I choose many roles in the "user roles", there will be wrong pages link under the irons.
I have a look at the code, I think this is because the SQL which tries to get the $total in the function "_avatar_selection_image_list". Because you use "LEFT JOIN" and "IN" in the SQL, so the total will not be correct.
I wish you can have a look at this and give me a response. Thanks!!
(I wish you can know what I say, because my English is not good......................)
Best wishes!!
Comment | File | Size | Author |
---|---|---|---|
#2 | screenshoot.jpg | 31.89 KB | mqh21364 |
Comments
Comment #1
stella CreditAttribution: stella commentedI'm afraid I don't totally know what you mean by
Perhaps a screenshot or an example would help.
Comment #2
mqh21364 CreditAttribution: mqh21364 commentedOk, I will give you a screenshot.
You can see in our site, we have 6 roles. I mean if the current user has many roles, and I choose many checkboxes in this page(the page in the screenshot), the error will appear.
Thanks!!
Comment #3
stella CreditAttribution: stella commentedOk so you have 7 roles to which you can assign avatars when you upload the images. What exactly is the error? What do you think should happen?
Comment #4
mqh21364 CreditAttribution: mqh21364 commentedOh, as you see, I have 7 roles these can assign avatars. So I have the same 7 roles can assign to the user.
I mean if I assign 2 roles to the user, and login with this user. Then I assign the same 2 roles to the avatars. I upload 10 avatars with the same 2 roles, fx.
So, the SQL in function _avatar_selection_image_list():
$total = db_result(db_query("SELECT count(*) FROM {avatar_selection} avs LEFT JOIN {avatar_selection_roles} avsr ON avs.aid = avsr.aid WHERE avsr.rid IS NULL OR avsr.rid IN (". $user_roles_placeholders .") ORDER BY weight, name, avatar", $user_roles));
will return 20. If all of the avatars have 3 roles and the current user has the same roles, it will return 30. It is not the correct count.
So, if I have 20 avatars, and all of them have 2 roles same with current user, the $count will be 40. If I set per page shows 30, there will be a link to the page "2", but it should not there.
Thanks!!
Comment #5
stella CreditAttribution: stella commentedWill investigate this further, thanks!
Comment #6
stella CreditAttribution: stella commentedFixed, this will be included in the next dev release available later today.
Cheers,
Stella
Comment #8
stella CreditAttribution: stella commentedReleased in 6.x-1.6 and 5.x-2.8.