I noticed that with invite_notification turned on, when a user edits his/her own profile and saves with a picture, the picture field is null after invite_notifications_init().

As it turns out, doing this:

global $user;
user_save($user, array('data' => array('notification_received' => FALSE)));

will kill the picture value, since the global $user's $user->picture contains the fid rather than the file reference itself.

When a user saves changes to another user with a picture, the picture isn't removed, but the acting user's picture is.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

franksj’s picture

Status: Active » Needs review
FileSize
545 bytes

I changed the invite_notifications_init() to load a user object rather than use the global $user.

Patch included.

franksj’s picture

Changed from updating $user to a new $account.

chobart’s picture

Patch from #2 works. Thank you!

kerasai’s picture

Status: Needs review » Reviewed & tested by the community

Good to go.

This bug occurs because the global $user is not a fully-populated user entity, and one of the discrepancies is the data structure behind $user->picture. The patch from #2 fixes the issue by loading the full user entity and saving that.

djween’s picture

After much time pulling out hair and reading through many many many issue queues of other modules and core, it turns out this module seems to be culprit for the user pic issue on my site too. Patch applied and so far so good.

ckng’s picture

Version: 7.x-4.0-beta2 » 7.x-4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed to dev.

  • franksj authored dfb957f on 7.x-4.x
    Issue #2292075 by franksj, ckng: User updates own profile. user->picture...

Status: Fixed » Closed (fixed)

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