View Full Version : Add Option to Moderation Tools
Artistichaven
01-26-2014, 01:57 PM
How can I add an option to the Moderation Tools dropdown portion of Thread Tools?
You would have to add your option to the SHOWTHREAD template, by editing the template or by doing a replacement in a plugin. Then you'd need a plugin using hook location threadmanage_action_switch to handle when it's selected (it's probably best to look at postings.php and search for that hook name to see how to handle it).
ozzy47
01-26-2014, 02:49 PM
What is it you are looking to add to it? This mod add quite a bit, https://vborg.vbsupport.ru/showthread.php?t=302780
Artistichaven
01-26-2014, 03:10 PM
What is it you are looking to add to it? This mod add quite a bit, https://vborg.vbsupport.ru/showthread.php?t=302780
Custom work specific to a forum's needs.
You would have to add your option to the SHOWTHREAD template, by editing the template or by doing a replacement in a plugin. Then you'd need a plugin using hook location threadmanage_action_switch to handle when it's selected (it's probably best to look at postings.php and search for that hook name to see how to handle it).
What do you mean by a replacement in the plugin? I was hoping I wouldn't have to edit any templates. Blergh.
What do you mean by a replacement in the plugin? I was hoping I wouldn't have to edit any templates. Blergh.
Fortunately I happened to know of a plugin that adds to that menu. The code (using hook showthread_start) looks something like this:
if(can_moderate($threadinfo['forumid']))
{
$vbulletin->templatecache['SHOWTHREAD'] = str_replace(
'$vbphrase[remove_redirects]</label></div>',
'$vbphrase[remove_redirects]</label></div>\n<div><label for=\"my_option\"><input type=\"radio\" name=\"do\" id=\"my_option\" value=\"my_option\" />My Option</label></div>',
$vbulletin->templatecache['SHOWTHREAD']
);
}
You'd want to replace all occurances of "my_option" with something else of course, and also the text "My Option" (and if you want to use a phrase for that, use something like $vbphrase[my_option])
Artistichaven
01-26-2014, 09:36 PM
Fortunately I happened to know of a plugin that adds to that menu. The code (using hook showthread_start) looks something like this:
if(can_moderate($threadinfo['forumid']))
{
$vbulletin->templatecache['SHOWTHREAD'] = str_replace(
'$vbphrase[remove_redirects]</label></div>',
'$vbphrase[remove_redirects]</label></div>\n<div><label for=\"my_option"\"><input type=\"radio\" name=\"do\" id=\"my_option\" value=\"my_option\" />My Option</label></div>',
$vbulletin->templatecache['SHOWTHREAD']
);
}
You'd want to replace all occurances of "my_option" with something else of course, and also the text "My Option" (and if you want to use a phrase for that, use something like $vbphrase[my_option])
Is it just me or is the code not working?
ozzy47
01-26-2014, 09:39 PM
It could be just you, or the code, what is the exact code you are trying to use?
Is it just me or is the code not working?
Yep, my fault, sorry about that. I edited the code without testing it, and there was an extra double quote in there. I fixed the code above.
ozzy47
01-26-2014, 09:58 PM
Nice catch Kevin. :)
Artistichaven
01-26-2014, 10:57 PM
Yep, my fault, sorry about that. I edited the code without testing it, and there was an extra double quote in there. I fixed the code above.
Sorry, I'm so tired. Thank you so much, I really appreciate the help.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.