XF 1.1 Removing all followers and followed on all users

Ingenious

Well-known member
Following an import from vB is there any easy way (or an SQL query) I can run to remove every user's followed and followers from their profiles please?
 

Ingenious

Well-known member
Just done that Jake and it's fixed it nicely - all the imported profiles are followed/follows free :) Thanks!
 

Chris D

XenForo developer
Staff member
I think it would be this SQL query:
Code:
DELETE FROM `xf_user_follow` WHERE `user_id` = 1 OR `follow_user_id` = 1
Where 1 is the user ID of the person who passed away.

But I see Jake has referenced the xf_user_profile table - that may be involved too.

I would wait for someone else to verify my answer, though, before running mine just in case there's some sort of dependency I'm not aware of.

In my testing, my query has worked, but I don't want to miss anything out.
 

Jake Bunce

XenForo moderator
Staff member
How do I remove all followers and following for a particular user (which passed away)?

Thanks!
Yorick's query will work for the normalized data. But with selective removals like this you will need to rebuild the denormalized data in xf_user_profile.following which can't be done with a simple query. A custom script is required.
 

Chris D

XenForo developer
Staff member
My query does that.

It removes the rows where user 1 is following or user 1 is followed.

But I'm concerned about Jake's comments. I'd want to ensure you did this properly, but unfortunately I don't know how to achieve what Jake mentions beyond my simple query.
 
Top