Notice: Undefined property: stdClass::$badges_all in user_badges_user_presave() (line 343 of .../user_badges/user_badges.module).

Warning: key_exists() expects parameter 2 to be array, null given in user_badges_user_presave() (line 343 of .../user_badges/user_badges.module).

I don't think this affects the functionality of the module at all, but I figured it should have a report. Original comment.

Comments

shane1090’s picture

This appears to be caused by the UID for the user not having been created yet so lookups for what badges that user have cannot be made. My fix for this was to simply check if the $account->uid was empty or not - the start of the 'user_badges_user_presave' function for me now looks like this:

function user_badges_user_presave(&$edit, $account, $category) {
  if (!empty($edit['roles']) && !empty($account->uid)) {

Notice the additional variable check in line 2.

Mizpah’s picture

Thanks shane1090,

This worked for me - any other issues found in later testing due to this ?

shane1090’s picture

Glad it worked for you Mizpah. I've not had any further issues as a result of this change.

nancydru’s picture

Status: Active » Fixed

Thanks for catching this.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Adding a source.