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!!

CommentFileSizeAuthor
#2 screenshoot.jpg31.89 KBmqh21364
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stella’s picture

Status: Active » Postponed (maintainer needs more info)

I'm afraid I don't totally know what you mean by

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.

Perhaps a screenshot or an example would help.

mqh21364’s picture

FileSize
31.89 KB

Ok, 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!!

stella’s picture

Ok 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?

mqh21364’s picture

Oh, 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!!

stella’s picture

Assigned: Unassigned » stella
Status: Postponed (maintainer needs more info) » Active

Will investigate this further, thanks!

stella’s picture

Status: Active » Fixed

Fixed, this will be included in the next dev release available later today.

Cheers,
Stella

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

stella’s picture

Released in 6.x-1.6 and 5.x-2.8.