J’ai accidentellement supprimé un champ utilisateur personnalisé. Cela signifie-t-il qu’il est entièrement supprimé de la base de données ou est-il toujours présent ?
S’il est toujours présent, existe-t-il un moyen de le restaurer (autre que la restauration d’une sauvegarde) ? Ou d’accéder à son contenu via l’explorateur de données ?
Just a thought, but surely there would be a way to recreate the Custom Field and hack together a script to retrieve and refill the data from within a backup using a temporary cloud server to write out the data from the original Custom Field?
Thanks for your thoughts. Yes, that’s obviously what backups are for. I don’t know what the smartest procedure would be for restoring user field content for, say, thousands of users. For me, the number the easiest procedure was to just do it manually. And that was actually surprisingly easy, so I mention it here (from memory, so I may have missed some detail):
When you download the backup file and open it for example with good old WinRAR, you’ll find another archive in there, so open that with WinRAR too. You’ll find an .sql file.
And now comes the good part: you can just open it as a text file (with the built-in WinRAR viewer or otherwise).
Search for the name of the field or some content you hapoen to know and you’ll find the table for that user field.
Now the only trickyness is that (at least in my case) the user ID is not the first but the second value in each row (I’d be curious what the first value represents (“COPY”)).
Actuellement, la suppression d’un champ personnalisé (les tables user_fields et user_fields_options si son field_type est dropdown) ne supprime pas les valeurs réelles des utilisateurs (table user_custom_fields). Une solution de contournement rapide (mais potentiellement dangereuse : faites une sauvegarde au préalable) consiste à :
Créer manuellement un nouveau champ personnalisé
Remplacer le nouvel identifiant de user_fields par l’ancien (cela nécessite un accès administrateur à la base de données) : UPDATE user_fields SET id=1 WHERE id=3; (en supposant que 3 est le nouvel identifiant et 1 l’ancien)
Si le champ était un menu déroulant, vous devrez effectuer une opération similaire dans user_field_options
Si des utilisateurs se sont inscrits sur votre site et ont rempli le nouveau champ avant que vous ne corrigiez le problème (ou si un utilisateur existant a rempli le nouveau champ), vous devrez également corriger ces données.