Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-07-2011, 01:21 PM
Wolver2 Wolver2 is offline
 
Join Date: Oct 2010
Posts: 106
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 09-07-2011, 02:22 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #3  
Old 09-08-2011, 10:19 AM
Wolver2 Wolver2 is offline
 
Join Date: Oct 2010
Posts: 106
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 09-08-2011, 04:33 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #5  
Old 09-08-2011, 04:43 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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] . '">';
    }

Reply With Quote
  #6  
Old 09-10-2011, 03:23 AM
Wolver2 Wolver2 is offline
 
Join Date: Oct 2010
Posts: 106
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #7  
Old 09-14-2011, 10:31 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Wolver2 View Post
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.
Reply With Quote
  #8  
Old 09-20-2011, 12:49 PM
Wolver2 Wolver2 is offline
 
Join Date: Oct 2010
Posts: 106
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #9  
Old 09-20-2011, 02:18 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Wolver2 View Post
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:54 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08517 seconds
  • Memory Usage 2,245KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete