Jump to content

Restore all of a user's posts / responses (unhide)


Go to solution Solved by Adriano Faria,

Recommended Posts

Hello,

A moderator flagged a few accounts as SPAMMERS making all their posts hidden.

The problem is that some of the users have >1000 posts and they're not spammer, they probably had access to their accounts because of passwords leaks on the internet.

Now I'm searching for a way to restore all the hidden posts/responses for these users, even if its through an SQL code, that would help us a lot.

I don't even understand that such an option doesn't exist yet.

Thanks in advance.

Link to comment
Share on other sites

Check what settings have been used for spammers.  ACP > Members > Content Moderation > Spam Prevention, Flagging Spammers tab then adjust the settings not to delete content.  You don't want that happening.

The only way back from deletion would be a selected restore from a recent database backup and I bet you can guess how I know...

Edited by Richard Arch
Link to comment
Share on other sites

  • Solution
54 minutes ago, FGS said:

Now I'm searching for a way to restore all the hidden posts/responses for these users, even if its through an SQL code, that would help us a lot.

You can run the following query in your PHPMyAdmin (your host panel:

update forums_posts set queued = 0 WHERE queued = 2 AND author_id = XXX;

where XXX is the member_id.

After that, hide and unhide any post just to update the cache so then it will dismiss the pending notice in the index/forum view.

DO AT YOUR OWN RISK.

Link to comment
Share on other sites

6 hours ago, Adriano Faria said:

You can run the following query in your PHPMyAdmin (your host panel:

update forums_posts set queued = 0 WHERE queued = 2 AND author_id = XXX;

where XXX is the member_id.

After that, hide and unhide any post just to update the cache so then it will dismiss the pending notice in the index/forum view.

DO AT YOUR OWN RISK.

Thank YOU ! Will try this soon and let you know. There shouldn't be a problem.

6 hours ago, Jim M said:

If you do wish to update manually via SQL, as mentioned by Adriano, it is at your own risk and please take a backup of your database before 🙂 .

No worries, backups are made daily 🙂

Link to comment
Share on other sites

Update:

So I've made a test and the code you mentionned wasn't enough because it's not restoring the topics the users created and the responses made to their topics are also hidden by Invision.

I've investigated more and found out that I had to do these additional steps to restore the topics created by the user and the responses :

  1. Find all the posts created by the user inside the "forums_topics" table (starter_id = user ID) and update the "approved" from "-1" to "1" ;
  2. Update all the responses inside the table "forums_posts" from "queued" = "2" to "0" where "topic_id" = "TOPIC_IDS_FOUND_IN_STEP_1".

I had to create a small PHP script to update them correctly, as the number is huge and was too lazy to update them one by one.

For those searching the SQL queries :

As mentionned by @Jim M don't forget to create a backup of your database before trying any modification and if you don't know what you're doing, don't do it 🙂 !

UPDATE forums_posts SET queued = 0 WHERE queued = 2 AND author_id = XXX;
UPDATE forums_posts SET queued = 0 WHERE queued = -1 AND author_id = XXX;

afterwards

UPDATE forums_topics SET approved = 1 WHERE approved = -1 AND starter_id = XXX;

and finally :

UPDATE forums_posts SET queued = 0 WHERE queued = 2 AND topic_id = XXX;

Thanks again for your help, you can now tag this topic as fixed.

Link to comment
Share on other sites

6 hours ago, FGS said:

So I've made a test and the code you mentionned wasn't enough because it's not restoring the topics the users created and the responses made to their topics are also hidden by Invision.

Yes, that’s the problem when you are used to technical terms: you take it to the letter. As you said “posts”, I showed you how to it with posts. Anyway, glad you figured it out.

Edited by Adriano Faria
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...