MyBB Community Forums

Full Version: Calling unapprove_posts function in plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

What would be the best approach to using the unapprove_posts function within a plugin that is hooked to the post datahandler?

I want a post to be unapproved immediately upon being posted.
You will need to hook at newreply_do_newreply_end and initialize the moderation class and make sure to check if the post is visible.
function foo()
	global $postinfo, $url, $lang;

	if($postinfo['visible'] == -2)
		// Draft post
	elseif($postinfo['visible'] == 1)
			// Visible post
			// Moderated post

	require_once MYBB_ROOT.'inc/class_moderation.php';
	$moderation = new Moderation;


Code is incomplete, hope it to be enough Smile