Can I undelete a custom user field?

I accidentally deleted a custom user field. Does that mean that it is entirely deleted from the database or is it still there?

If it is still there, is there any way of undeleting it (apart from restoring a backup)? Or to access the contents via the data explorer?

I’m 95% sure a deleted custom field is gone forever.

If you can’t see it in data explorer, it’s not there anymore.

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”)).

현재 사용자 정의 필드(필드 유형이 dropdown인 경우 테이블 user_fields와 user_fields_options)를 삭제해도 사용자의 실제 값(테이블 user_custom_fields)은 삭제되지 않습니다. 따라서 빠르지만 잠재적으로 위험할 수 있으므로(반드시 백업 후 진행) 다음과 같은 임시 해결 방법을 사용할 수 있습니다:

  1. 새 사용자 정의 필드를 수동으로 생성합니다.
  2. 새 user_fields의 id를 기존 id로 교체합니다(이 작업에는 데이터베이스에 대한 관리자 권한이 필요합니다): UPDATE user_fields SET id=1 WHERE id=3; (3이 새 id이고 1이 기존 id라고 가정)
  3. 해당 필드가 드롭다운이었다면 user_field_options에서도 유사한 작업을 수행해야 합니다.
  4. 수정 전에 사이트에 가입하여 새 필드를 작성한 사용자가 있거나, 기존 사용자가 새 필드를 작성한 경우 해당 데이터도 수정해야 합니다.