I have set up a basic drupal install, and during testing I found that avatar selection displayed this error when a user did not select an avatar (when it was mandatory to do so).

# warning: array_keys() [function.array-keys]: The first argument should be an array in /home/***/public_html/modules/avatar_selection/avatar_selection.module on line 327.
# warning: array_fill() [function.array-fill]: Number of elements must be positive in /home/***/public_html/modules/avatar_selection/avatar_selection.module on line 328.
# warning: implode() [function.implode]: Invalid arguments passed in /home/***/public_html/modules/avatar_selection/avatar_selection.module on line 328.

Other than the display of this error, the module works great.

I'm looking into a fix, but I figure I'd leave this here just in case you all had a similar issue. Any advice is appreciated, of course. Thanks!


LynnS’s picture

I have the same issue.

LynnS’s picture

Imperfect solution, but it turns off the warnings:

At line 325 change to

  elseif (!empty($user) && ($user->uid > 0)) {


  elseif (!empty($user)) {

This turns off avatar selection at sign-up, but it stops the error messages. People can always choose an avatar once logged-in.

stella’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce this issue, is it still happening with the 5.x-2.7 release? How about the latest dev release? Does it only happen on the user registration page? What are your other settings?

This might be a duplicate of #303290: Or simply select an icon field is required.. Can you try the latest dev release?


livefordo’s picture

Hi stella,

Yes still the problem is there (Warning displayed when no avatar is selected)

stella’s picture

Can you confirm you're using the latest dev release? Sorry, just want to be sure.

livefordo’s picture

Ya yes stella i am using the new dev release 5.x-2.7 and my drupal version is 5.15 Can u fix this soon

stella’s picture

@livefordo avatar_selection 5.x-2.7 is not the dev release. Please use avatar_selection 5.x-2.x-dev release

livefordo’s picture

Hello Stella sorry for the wrong information...I am saying i know 5.x-2.7 is not the dev release but it's not working perfectly when no Avatar was selected in registration form...

stella’s picture

This issue should already be fixed in the dev release. Could you upgrade to it please?

husztisanyi’s picture

Assigned: Unassigned » husztisanyi

I tried the 5.x-2.x-dev release, but there is the probleme, if check on this:

"Automatically set a random avatar image to be used when the user doesn't set one for their account."

If check off, the module work fine!

The probleme may be here:
362 elseif ($user->uid != 0 || in_array(1, array_keys($user->roles))) {
because when I changed:
362 elseif ($user->uid != 0 ) {
...it works fine again.

stella’s picture

Do you have enough available user avatars for each of your roles? In particular the 'authenticated user' role?

stella’s picture

Status: Postponed (maintainer needs more info) » Fixed

The change in comment #10 isn't correct, as it allows anonymous users access to all avatars. I've committed a fix for anonymous permissions, so a fix should be available in the next dev release later today.


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.