• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Someone has soft deleted most of the threads, how to retian it? :(

RoldanLT

Well-known member
#1
Some of my mods, abuse their permissions.
A lot of threads where deleted, but just soft deleted.
How to un-delete all soft deleted threads?
:(
 

Chris D

XenForo developer
Staff member
#2
Select the deleted thread or threads by clicking the checkbox next to each one in the thread list.

In the inline moderation drop down there is an undelete option.
 

Chris D

XenForo developer
Staff member
#4
Before they deleted the threads, did you have many soft deleted threads already?

If not, I can suggest a database query that will undelete them automatically - but there will be no way to distinguish between threads that are supposed to be deleted vs the threads they deleted maliciously.

So we either do that and risk undeleting some stuff that was supposed to be deleted or you are just going to have to use the inline moderation tools (there is a Select All button).
 

RoldanLT

Well-known member
#6
I have learned, to disable hard delete permission for moderator.
Yes, it help for me a little bit.
But for now, I want to un-delete all of the threads that where soft deleted.
 

Chris D

XenForo developer
Staff member
#7
Code:
UPDATE xf_thread
SET discussion_state = 'visible'
WHERE discussion_state = 'deleted'
AND node_id IN (2,3,4)
That query should do it......

Notice this will only run on threads in forums "2,3,4" - you can change that accordingly to the forums you want to run it on, or just delete that entire last line to make it run on all forums.
 

RoldanLT

Well-known member
#8
Code:
UPDATE xf_thread
SET discussion_state = 'visible'
WHERE discussion_state = 'deleted'
AND node_id IN (2,3,4)
That query should do it......

Notice this will only run on threads in forums "2,3,4" - you can change that accordingly to the forums you want to run it on, or just delete that entire last line to make it run on all forums.
Awesome, everything works fine now.
How about restoring soft deleted post?
 

Chris D

XenForo developer
Staff member
#9
Same thing, really. Remove the last line and change "xf_thread" to "xf_post" and change "discussion_state" to "message_state".

There's one last step that bobster kindly reminded me of.

Once you've finished undeleting stuff, you will probably want to rebuild your various caches... Admin CP > Tools > Rebuild Caches.

Rebuild thread information (with post counters), poll information, forum information and then finally rebuild the search index.

The rebuilding of the search index may take a long time... but without doing that, you might find that threads are missing when you search.
 

RoldanLT

Well-known member
#10
After doing this, threads/post got recovered and open.

But then, User Post Count, Likes do not update.
How can I fix this?
I already did rebuild caches.

Thread Information, Forum Information, User Caches, Daily Statistics and Search Index, still user's stats not updating.