MyBB Community Forums

Full Version: automatic delete last post when o open thread
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Gi

I need your help i have this

function plugin_moderation ()
{
    global $db , $lang , $mybb , $theme , $templates , $header, $footer , $
headerinclude , $plugin ;
$lang -> load("plugin" );
if( $mybb -> settings
[ 'plugin_close_text_onoff' ] == '1' && $mybb -
> settings[ 'plugin_onoff' ] == '1' )
{
$plugin = false ;
if( $mybb -> input [ 'action' ] !
= 'openclosethread' )
return;
$tid = (int) $mybb-> input [ 'tid' ];
$thread = get_thread ( $tid );
if( $thread [ 'closed' ] == 1)
return;
if(isset( $mybb-> input
[ 'confirm' ]) && $mybb -> input
[ 'confirm' ] == 1)
{
if(!isset( $mybb -> input
[ 'reason' ]) || $mybb -> input
[ 'reason' ] == '')
{
error( $lang -
> plugin_reason_empty );
}
$plugin = true;
}
else
{
eval( "\$page = \"" .
$templates -> get ( "plugin" ). "\";" );
output_page ( $page );
exit;
}
}
}

how add this code

if (empty($moderation))
{
    require_once MYBB_ROOT."inc/class_moderation.php";
    $moderation = new Moderation;
}
$moderation->delete_post($thread['lastpost']); 

global $moderation;


i wont to
When thread is cl and when I click open cl i standard mod options last post automatic delete

Plis help

sory for my English
why this function not delete last post ?

function plugin_deletelastpost($tids)
{
	global $moderation;

	$tid = (int)$mybb->input['tid'];
	$thread = get_thread($tid);
	$fid = $thread['fid'];

			if (empty($moderation))
			{
				require_once MYBB_ROOT."inc/class_moderation.php";
				$moderation = new Moderation;
			}
				$moderation->delete_post($thread['lastpost']); 
}