I just installed 1.0 on my Drupal 7 blog and noticed that all anonymous comments inherited the picture from the first commenter. Upon inspection, it seems that _gravatar_load_account was at fault. When user_load is called, Drupal returns the statically cached instance of the user object which, for anonymous, will always be the "first found". I guess this is linked to the Entity API somehow...

The fix I have applied is to pass the reset flag as TRUE if $account->uid is zero... So the account loading line is now:

$account = user_load($account->uid, ($account->uid == 0));

I guess the alternative is to always overwrite with the "original" values if uid is 0?


Dave Reid’s picture

Status: Needs review » Fixed

Thanks for reporting. I confirmed the bug and fixed it using $account = $account->uid ? user_load($account->uid) : drupal_anonymous_user() - since that function creates a new object every time it's safe for us to modify anonymous $account objects then.


Status: Fixed » Closed (fixed)

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