vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Default Prefix (Without Dropdown menu) (https://vborg.vbsupport.ru/showthread.php?t=269833)

Wolver2 09-07-2011 12:21 PM

Default Prefix (Without Dropdown menu)
 
Something my users are complaining about is the extra step on Prefixes while creating a Thread

What if only 1 Prefix is available and it is Required.. They still have to click on dropdown and choose.

Is there to bypass this timewaste extra step?

Lynne 09-07-2011 01:22 PM

There is no default method to bypass this. I suppose you may be able to write a plugin that checks to see if there is a prefix selected and if not then use prefix xxxxx . It just doesn't sound like a scenario that would happen though - why only have one prefix in a forum?

Wolver2 09-08-2011 09:19 AM

Only 1 for the purpose of having an overview, example in the Request section [REQ] only. It would be a timesaver to have at default set. So that the Thread would look like "[REQ]Diary of Mr. Shntzekn poem" as example.

I really wish there would be such a default function in the feature as Im sure alot of people would want it aswell :)

Lynne 09-08-2011 03:33 PM

Why use a prefix for that? Why not just write a plugin for all thread titles in that forum to add "[REQ] " at the beginning?

kh99 09-08-2011 03:43 PM

Lynne has a good point, but I thought I'd look at it anyway. Here's the code for a plugin using hook newthread_form_complete that changes the prefix dropdown to a hidden field if there's only one option and a prefix is required:

PHP Code:

if ($foruminfo['options'] & $vbulletin->bf_misc_forumoptions['prefixrequired'])
{
    if (
preg_match_all('#<option value="([A-Za-z0-9_]+)"#'$prefix_options$matches) == 1)
    {
        
// one option, so disable prefix option dropdown and tack a 
        // hidden field on to the end of the $human_verify html
        
$prefix_options '';
        
$human_verify .= "\r\n" '<input type="hidden" name="prefixid" value="' $matches[1][0] . '">';
    }



Wolver2 09-10-2011 02:23 AM

Thank you very much kh99 and Lynne for answering my questions and helping out! ,

I mean its also usefull even if its not only 1 Prefix, but I mean it is also usefull to have 1 default one set while making a thread, instead of showing "choose a prefix".

I just see the code kh99 but I am unsure how I implement it into my forum? As I would really love to use the plugin you wrote... Do I need to setup an xml file first for it?

kh99 09-14-2011 09:31 AM

Quote:

Originally Posted by Wolver2 (Post 2244140)
I just see the code kh99 but I am unsure how I implement it into my forum? As I would really love to use the plugin you wrote... Do I need to setup an xml file first for it?

You just need to use "Add ew Plugin" under "Plugins & Products" in the adminCP, and

- Choose newthread_form_complete from the hook location drop-down
- Enter a title so that later you'll remember what it does
- Paste the code in the large box
- Click the "Yes" radio button and hit save


BTW, if you want to have the prefix selected instead of hiding the prefix, you can use this:

Code:

if ($foruminfo['options'] & $vbulletin->bf_misc_forumoptions['prefixrequired'])
{
    if (preg_match_all('#<option value="([A-Za-z0-9_]+)"#', $prefix_options, $matches) == 1)
    {
        $prefix_options = preg_replace('#<option value="([A-Za-z0-9_]+)"#', '\\0 selected="selected"', $prefix_options);
    }
}


That only selects one if there's only one and it's required, but you could modify it of course.

Wolver2 09-20-2011 11:49 AM

Thanks it worked like a charm! I really apreciate your help!

, may I ask how I can disable my new plugin? as it is not listed on the manage Products

kh99 09-20-2011 01:18 PM

Quote:

Originally Posted by Wolver2 (Post 2248201)
may I ask how I can disable my new plugin? as it is not listed on the manage Products

If you visit the "Plugin Manager" you can disable plugins individually.


All times are GMT. The time now is 10:51 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.01784 seconds
  • Memory Usage 1,735KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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