Hello!

If I save user settings (/user//edit) then I got error:

recoverable fatal error: Object of class stdClass could not be converted to string in /home/u2799/domains/shah-online.ru/sites/all/modules/user_badges/user_badges.module on line 218.

Comments

sbefort’s picture

Same issue here.

leebroozlee’s picture

It looks like a problem with the static $badges variable in the
user_badges_user() function.

we have:
static $badges = array();

then later on:
$badges[$account->uid] = $account->badges;
so $badges are arrays of badges, keyed by user ids.

but later from within same function:
$badges = user_badges_get_badges('select');
which makes the static $badges an array of badge names (strings), keyed by badge id.

I fixed mine by changing $badges to instead use a variable name $all_badges
from within the 'insert' and 'update' select cases in the user_badges_user() function

-paul

calefilm’s picture

Thank you Paul! Your solution solved my error.

With deep thanks,
Cale

alexx90’s picture

can you plz tell me witch file and witch line I have to change that

cause I tried to find where but there are a lot of $badges

and thank you

calefilm’s picture

I don't remember this one but looks like I probably changed it around line 218 like the original posters error:

"user_badges/user_badges.module on line 218."

so that would be user badges module, open up file 'user_badges.module' and search for '$badges'

then follow what leebroozlee did. Best I can suggest

shabana.navas’s picture

Status: Active » Closed (fixed)

Fixed in Version 7. Please upgrade to Version 7.x-3.x.