MyBB Community Forums

Full Version: How to create new moderation option?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone. I am in the process of creating a plugin that enable moderator new functionality - similar to Open / Close Thread & Stick / Unstick Thread. I manage to create a new option in Moderation Option via find_replace_templatesets(). However I do not know how to proceed after that.

I want a page similar to this when my custom option is selected.

https://i.imgur.com/VpmiYn9.png

I looked into moderation.php and found codes like case "multisoftdeleteposts": and case "do_deletethread": etc. And I guess I will need to create a case for my option value. However, I can't seem to find any hooks in moderation.php that allow me to do that.

I also found $custommod = new CustomModeration; which I feel is something related to what I am trying. I checked the database and find mybb_modtools table. After some research I also found this function mybb_modtools which I do not know how to use.

How can I make a new moderation option? Helps will be appreciated.

Edited: After looking at moderation.php, I found the function I need - moderation_redirect(). Now, how do I set the first parameter (url) to last thread visited? I tried get_thread_link($tid) but it is not working.

Edited: So what I need is $tid = $mybb->get_input('tid', MyBB::INPUT_INT);. Everything is okay now. Thanks to those who tried helping.
You should create a plugin instead, like so:

<?php

defined('IN_MYBB') or die('Nope');

$plugins->add_hook('moderation_start', 'mynewmoderationaction');

function new_moderation_action_info()
{
	return [
		'name'          => 'New Moderation Action',
		'description'   => 'moderation.php?action=newaction',
		'website'       => 'http://community.mybb.com/user-83692.html',
		'author'        => 'Sazze',
		'authorsite'    => 'http://community.mybb.com/user-83692.html',
		'version'       => '1.0',
		'compatibility' => '18*'
	];
}

function new_moderation_action_activate()
{
	//Blah
}

function new_moderation_action_deactivate()
{
	//Blah
}

function mynewmoderationaction()
{
	global $mybb;

	if($mybb->get_input('action') == 'newaction')
	{
		die('New action made by Sazze');
	}
}

You should now be able to access: moderation.php?action=newaction

Edit: plugin name should be new_moderation_action.php
(2016-07-24, 12:06 PM)Sazze Wrote: [ -> ][snip]

Yes. I am creating a plugin and it is something similar to yours. What I was trying to achieve is to output some text with moderation.php template. I managed to do it with moderation_redirect().

Thank you for trying to help. I've now figured out how to create a custom moderator option.