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.
Modules can add data to a user's serialized data array by doing:
$user->data['foo'] = 'bar';
It would be ideal if a module in hook_uninstall() could perge the keys it stores in the array. However, this is not as simple as droping a column from the users table, since the data is stored in a single column as a serialized array, and to do so would require retrieving each row of the table, and saing those wher the key existed and was removed.
I am not sure if there is a performant method of doing this, or if it is even necessary based on the nature and quantity of data stored. But, I think it is worth a discussion.
Comments
Comment #3
dpiUser data was re-written into a service for Drupal 8. All data is assigned to a module. When a module is uninstalled, the user data is also purged.