Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By dsevcik on
When our users upload an avatar and save, they can see the image. However, when logging out, and logging back in, the image is gone.
I've confirmed the images exist after upload in our sites/defaults/pictures directory
Any thoughts?
Comments
Permissions, even when we set
Permissions, even when we set to 777, the image does not display upon logging back in.
Initial permissions on the image are set to 664. But changing that still does not show them after we log back in.
The sites/default/files/picture has a 777 permission.
We've narrowed down the issue
We've narrowed down the issue to the database. After saving the profile, the user.pictues field has an id for our image. When logging out, that field goes back to zero.
I found a function
I found a function user_file_delete which sets the picture id to 0.
Why is this in the user.module file?
I tried commenting this out, but this did not help. Drupal still sets the picture field in the "users" table to 0.
More Issues
The issue seems to be the user_load function does not return anything for $user_fields->picture and $user_fields->picture->uri.
$user_fields returns name and other items though.
Any thoughts?
same problem, any solution?
same problem, any solution?
Fix
A friend helped fix this. It appears that the avatar_selection module had some bad queries in it. The fix was to update those queries, and then delete all your avatars, and then reload them.
i was using avatar selection
i was using avatar selection too...
but that queries? in module? or in phpmyadmin?
thank u
upd. avatar dissapear after flush cache
The actual fix for code was
The actual fix for code was in the module. After we fixed that to match the database columns, we deleted all the avatars and uploaded them again so that the database would be reset and matching.
Can you please give a more
Can you please give a more specific explanation how you solved that problem? I am running Drupla 7.19 an have exactly the same problem. But what avatar module you are talking about, I am using Drupal's core functions for the user picture? So what exactly do I have to update to get rid of the problem?