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.
Any clue how to refresh in proper way cached user->data object in 6.x?
#337182: Profile fields not updated in user data
user_save(user_load($node->uid));
doesn't work, because it's loading already cached data, and it's saving it over again
It's a bug?
Comments
Comment #1
kenorb CreditAttribution: kenorb commentedOr module which updating some fields should unserialize and serialize those changes manually? It's quite stupid.
Comment #2
Damien Tournoud CreditAttribution: Damien Tournoud commented$user->data is not a cache, but a storage mechanism for modules that do not provide their own storage and use
hook_user()
to manage it. I'm not sure what you mean there.Comment #3
kenorb CreditAttribution: kenorb commentedI though it's kind of cache.
In example, Content Profile integrate content type fields with user object.
If one of the field has been updated, user object is not updated. So it have to load the user, update the fields and save it again.
So that's mean that module should update this storage mechanism manually?
Like: http://drupal.org/files/issues/profile_fields_not_updated.patch
Comment #4
kenorb CreditAttribution: kenorb commentedCode to manually refresh some some custom fields into user object:
where $node->uid is the user id.
It can be use for integrating user profile. In example: content_profile module
Comment #5
kenorb CreditAttribution: kenorb commentedComment #7
pieter_duijves CreditAttribution: pieter_duijves commentedwrite:
read:
Comment #8
pdcarto CreditAttribution: pdcarto commentedI tried storing entity data (membership_entity) in the user's data property and discovered that will not work because that entity type's controller does not yet exist when the user is loaded.