Ho accidentalmente eliminato un campo utente personalizzato. Significa che è stato completamente rimosso dal database o è ancora presente?
Se è ancora presente, esiste un modo per recuperarlo (a parte il ripristino di un backup)? Oppure è possibile accedere ai contenuti tramite l’esploratore dei dati?
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”)).
Attualmente, eliminare un campo personalizzato (tabelle user_fields e user_fields_options se il suo field_type è dropdown) non elimina i valori effettivi degli utenti (tabella user_custom_fields), quindi una soluzione rapida (ma potenzialmente pericolosa: effettua prima un backup) consiste nel:
Creare manualmente un nuovo campo personalizzato
Sostituire il nuovo ID in user_fields con quello vecchio (questo richiede l’accesso amministrativo al database): UPDATE user_fields SET id=1 WHERE id=3; (assumendo che 3 sia il nuovo ID e 1 quello vecchio)
Se il campo era un menu a tendina, dovrai fare qualcosa di simile anche in user_field_options
Se alcuni utenti si sono registrati al tuo sito e hanno compilato il nuovo campo prima che tu correggessi il problema (o se un utente esistente ha compilato il nuovo campo), dovrai correggere anche quelli.