vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Add Option to Moderation Tools (https://vborg.vbsupport.ru/showthread.php?t=307511)

Artistichaven 01-26-2014 12:57 PM

Add Option to Moderation Tools
 
How can I add an option to the Moderation Tools dropdown portion of Thread Tools?

kh99 01-26-2014 01:21 PM

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 01: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 02:10 PM

Quote:

Originally Posted by ozzy47 (Post 2476944)
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.

Quote:

Originally Posted by kh99 (Post 2476939)
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.

kh99 01-26-2014 02:23 PM

Quote:

Originally Posted by Artistichaven (Post 2476961)
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:
Code:

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 08:36 PM

Quote:

Originally Posted by kh99 (Post 2476968)
Fortunately I happened to know of a plugin that adds to that menu. The code (using hook showthread_start) looks something like this:
Code:

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 08:39 PM

It could be just you, or the code, what is the exact code you are trying to use?

kh99 01-26-2014 08:57 PM

Quote:

Originally Posted by Artistichaven (Post 2477061)
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 08:58 PM

Nice catch Kevin. :)

Artistichaven 01-26-2014 09:57 PM

Quote:

Originally Posted by kh99 (Post 2477065)
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.


All times are GMT. The time now is 06:10 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03046 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete