Can anybody suggest a good method for deleting a batch of users who all share the same BP xprofile field value?.
Example:
I have a group of users who all belong to multiple blogs, and all share the same value in a particular xprofile field - say "Registration Group = abc123"
I need to find, and completely delete these users from the system - not just from the main blog, but from all blogs.
Can anybody suggest a good method for deleting a batch of users who all share the same BP xprofile field value?.
Example:
I have a group of users who all belong to multiple blogs, and all share the same value in a particular xprofile field - say "Registration Group = abc123"
I need to find, and completely delete these users from the system - not just from the main blog, but from all blogs.
So I guess you could probably create a custom foreach loop to go through the user list and use those two functions within it. Unfortunately, I can't seem to quickly find a pre-made, updated way to get that list.
Perhaps others around here may be able to add to this.
Just wanted to add/clarify here, as I think my mention of the xprofile field was sort of a red herring.
What I'm really trying to accomplish is deleting specific users from ALL blogs on this installation. The xprofile field is merely a way to find a particular batch of users.
Unfortunately this client is still running WPMU 2.9.2. Looking forward to seeing the site updated, but it is what it is for the moment.
It appears that with 2.9.2, deleting a user from the Site Admin > Users panel seems to only delete the user from the primary blog. Is this expected behavior, or am I missing something somewhere? Is there perhaps something in the Admin UI for 2.9.2 that I'm overlooking?
Responses (2)
WPMU DEV Fanatic — 15th September 2011 #
Hi airfoil,
I imagine the best thing to do would be to write a custom script for that as going through the database could be a vastly tedious task.
The following should help you get the data from the field in specific.
xprofile_get_field_data( $field_name_or_id [, optional $user_id] )And I would think you could delete the user once you've found they have that field with wp_delete_user():
http://codex.wordpress.org/Function_Reference/wp_delete_user
So I guess you could probably create a custom foreach loop to go through the user list and use those two functions within it. Unfortunately, I can't seem to quickly find a pre-made, updated way to get that list.
Perhaps others around here may be able to add to this.
Cheers,
David
Member — 16th September 2011 #
Just wanted to add/clarify here, as I think my mention of the xprofile field was sort of a red herring.
What I'm really trying to accomplish is deleting specific users from ALL blogs on this installation. The xprofile field is merely a way to find a particular batch of users.
Unfortunately this client is still running WPMU 2.9.2. Looking forward to seeing the site updated, but it is what it is for the moment.
It appears that with 2.9.2, deleting a user from the Site Admin > Users panel seems to only delete the user from the primary blog. Is this expected behavior, or am I missing something somewhere? Is there perhaps something in the Admin UI for 2.9.2 that I'm overlooking?
Thanks.
Become a member