XF 2.1 How can admin remove a user's reaction from a post?

Mr Lucky

Well-known member
I seem to have a user attempting to spam peoples' posts with inappropriate reactions.

So I wonder if there is a way to remove them. I managed to catch the user before he did too many and removed his reaction permssions, but does anyone know of an addon or else where I might find a way to do this one by one in the database?

I see in xf_post there is reactions and reaction_users, but I have no idea how to deal with BLOB - 2 B

EDIT: maybe login as user addon, but I'd rather find another solution first
 
I'm sure XF devs/support won't recommend this, but editing the database row seems to work fine, at least in XF 2.2.

Here's how:

  1. Find the post ID by clicking the post number located in the top right area of the post. The post number will then be shown at the end of the URL.
  2. Then log in to your MariaDB/MySQL database and run this query to see the contents of the reactions-related columns for that post:
    SQL:
    SELECT reaction_score, reactions, reaction_users FROM xf_post WHERE post_id = 123456\G
    (Note that the "\G" at the end is intentional - it displays the columns vertically so they are easier to read. You can exchange it with a ";" instead for horizontal display, if you prefer.)
  3. You will hopefully get a result that looks similar to this:
    reaction_score: 1
    reactions: {"5":1,"3":1}
    reaction_users: [{"user_id":123,"username":"bob","reaction_id":5},{"user_id":666,"username":"joe","reaction_id":3}]
  4. Now run an update statement to re-write the content of these columns for this particular row, but without the offending reaction and user - be careful not to forget the WHERE clause:
    SQL:
    UPDATE xf_post SET reactions = '{"5":1}', reaction_users='[{"user_id":123,"username":"bob","reaction_id":5}]' WHERE post_id = 123456;
 
Back
Top Bottom