MyBB Community Forums

Full Version: Task Plugin: Auto Purge Old Soft Deleted Post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

Have plugin for this?

Task plugin that delete "Soft Deleted Post" posted x week before.
Is a lazy having to remove one by one.

Thanks.
sounds like a good idea.. better to suggest this in Feedback section... it would be great if all soft deleted posts are stacked up either in the (preferrably) admin cp or mod cp, just like the Moderation Queue.....
(2014-11-25, 12:10 PM)mmadhankumar Wrote: [ -> ]sounds like a good idea.. better to suggest this in Feedback section... it would be great if all soft deleted posts are stacked up either in the (preferrably) admin cp or mod cp, just like the Moderation Queue.....

for me better as plugin...
i only need task file...

Not need more...
i made task for me...

if someone interest https://gist.githubusercontent.com/marte...tfile1.php

default: delet soft deleted message older than 3 days...
3*86400 => 3 days... so if you want other amounts of days, very easy to change...

rename to aposdo.php and put to task folder... and configure task in ACP and select aposdo.php .
And if you want to delete at the same way "Soft Deleted" threads you can add to the code of the PHP you can add a query to delete -1 threads will looks like:

<?php
/**
 *	Auto Purge Old Soft Deleted Post
 *
 *	@author martec <http://community.mybb.com/user-49058.html>
 *	@version 0.50
 */

if (!defined('IN_MYBB')) {
	die('Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.');
}

function task_aposdo($task)
{
	global $db;

	$time = 3*86400;

	if ($db->delete_query('posts', '(visible = -1) AND (dateline < '.(TIME_NOW-$time).')')) {
		add_task_log($task, 'Old soft deleted posts were deleted successfully!');
	} else {
		add_task_log($task, 'Something went wrong while cleaning up the old soft deleted posts...');
	}
		if ($db->delete_query('threads', '(visible = -1) AND (dateline < '.(TIME_NOW-$time).')')) {
		add_task_log($task, 'Old soft deleted threads were deleted successfully!');
	} else {
		add_task_log($task, 'Something went wrong while cleaning up the old soft deleted threads...');
	}
}