Calling unapprove_posts function in plugin
#1
Hi,

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.
Need web hosting? Try MyBBWebHost!
#1 for Running MyBB Communities
The world's only premium web host dedicated to MyBB forums.

Reply
#2
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
	}
	else
	{
			// Moderated post
	}

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

	$moderation->unapprove_posts($postinfo['pid']);
}

Code is incomplete, hope it to be enough Smile
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)