Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 12-20-2010, 12:19 PM
symptome symptome is offline
 
Join Date: Aug 2005
Location: Z?rich
Posts: 176
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Check Titles - automatically correct

I've got the problem, that many people use titles with plenty of !!!!!?????-Signs.
I always edit those titles to delete those signs.
Another typical faults is, that after a comma there is no space.

Isn't there a possibility that creation of a thread corrects those things in titles automatically?

Thanks!
Reply With Quote
  #2  
Old 12-20-2010, 03:38 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I put together a quick plugin that will tell a user to fix a mistake (not fix it for them) if they enter more than one ! or ? or a combination of ?! in a row...

So:
This! Is! OK!
But
This is NOT OK!!!

Also it should stop commas with no space after them...

Good:
this is a good, comma usage!
Bad:
this will not,be allowed!

Go to your Admin CP -> Plugin Manager -> Add a New Plugin

Product: vBulletin
Hook: newthread_post_start
Title: Thread Title Punctuation Check
Code"
PHP Code:
$checktitle $vbulletin->GPC['subject'];
$regpat "/[\w \(\)\[\]<>]+,[\w\(\)\[\]<>]/";

   if ( 
strpos($checktitle"!!") OR strpos($checktitle"??") OR strpos($checktitle"?!") OR strpos($checktitle"!?") OR preg_match ($regpat$checktitle) )
   {  
      
standard_error("Please fix the punctuation in the thread title. Excessive ! and ? are not allowed and commas must be properly spaced. <input type=\"button\" id=\"backbutton\" class=\"button\" value=\"Go Back\" title=\"\" tabindex=\"1\" onclick=\"{ history.back(1);}\">");
   } 
Set ACTIVE to YES
and SAVE.
Reply With Quote
  #3  
Old 12-20-2010, 05:37 PM
symptome symptome is offline
 
Join Date: Aug 2005
Location: Z?rich
Posts: 176
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Simply brillant!
Thanks a lot!

I believe, I will add some more
Like the 2 or 3 usual smileys ...
Or "..."
Reply With Quote
  #4  
Old 12-22-2010, 04:09 AM
symptome symptome is offline
 
Join Date: Aug 2005
Location: Z?rich
Posts: 176
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Or would it be possible to write the above to be executed automatically without showing any error to the member?
Reply With Quote
  #5  
Old 12-22-2010, 04:25 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not that I can do... you might find someone else willing and able.
Reply With Quote
  #6  
Old 12-22-2010, 01:07 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Something like this might work for you:

PHP Code:
static $pattern = array('/!+/''/\?+/''/(!\?|\?!)[\?!]+/''/,(\S)/');
static 
$replacement = array('!''?''\\1'', \\1');

$vbulletin->GPC['subject'] = preg_replace($pattern$replacement$vbulletin->GPC['subject']); 
(This allows ?! or !?, but you could change it to disallow that if you want).
Reply With Quote
Reply

Thread Tools
Display Modes

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 11:40 PM.


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.05317 seconds
  • Memory Usage 2,206KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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_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