Is it possible to delete data from a specific custom member field in every member account in one operation (ie not going through every member account and deleting the data one at a time)?
3 Answers
Okay this should do it for you. First of all you need to find the ID number of the member field that you wish to clear. You can do this by going to
Members->Member Fields
In here you should see all your custom member fields and an ID (first column) for each. Note down the number of the field that you wish to clear the data from then run this query in
Tools->Data->SQL Manager->Database Query Form
or a SQL tool of your own choice if you prefer.
UPDATE exp_member_data SET m_field_id_1 = ""
Change the 1 in the query above to the number that you retrieved of your custom member field previously.
Hopefully that should do what you need here. Definitely backup your database first before doing this though as best practice.
Could you not simply delete the custom member field? This would also delete the data from every member account.
-
1Of course that is obviously quicker ;-) Would mean recreating the field again after if you still wanted it there but yep definitely faster!! :-) Commented Sep 8, 2014 at 15:32
You could definitely do this performing a query directly upon the database although you'd want to make a backup of said database first just incase anything went awry. I'm not entirely sure if there's an add-on out there to do this sort of thing, I think there is although it would be doing the same sort of thing anyway and a direct query connection to the database would be faster.
Are you okay with performing queries directly upon your database? You would need some sort of MySQL admin panel or a MySQL client in order to do this.
What version of ExpressionEngine are you running?
-
I accepted this answer - although I think I'm going to have to work out how to do it! The version is 2.5.3– AndrewCommented Sep 8, 2014 at 15:16