View Full Version : Default Prefix (Without Dropdown menu)
Wolver2
09-07-2011, 01:21 PM
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, 02: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, 10: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, 04: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?
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:
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, 03: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?
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:
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, 12:49 PM
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
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.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.