Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-01-2010, 10:58 AM
Dj Smuggla Dj Smuggla is offline
 
Join Date: Sep 2009
Posts: 148
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Scan New Posts For Hide Tags

Im using a hide hack on my forum & its hard to make members use it, especially new members.

So is there anychance a coder could knock up a quick lil script, that scans a members post for [HIDE] tags when they click
'Submit New Thread'.

If there's no hide tags in the message area, the member gets a error saying 'You must use hide tags in your message'
& their post does not get submitted.

I've just found another site that uses something like this, check the attached screen.

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

OMG why would you force someone to use HIDE tags if they don't want to? If you don't want non-members viewing threads you can set the permissions to keep them out.
Reply With Quote
  #3  
Old 10-01-2010, 06:43 PM
Dj Smuggla Dj Smuggla is offline
 
Join Date: Sep 2009
Posts: 148
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thats the rules on my site. You hide a part of the thread, members reply & then can see the unhidden content.

Anyway all thats sorted my hide hack works perfectly, i just need a script that checks if the member has used them & gives a error if they havent. Like i stated in the first post^^^

Would that be somthing you could take a look at BirdOPrey5
Reply With Quote
  #4  
Old 10-01-2010, 07:33 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 could code the part where it would look for the "[HIDE]" tag no problem, but getting it to return an error instead of post is still beyond me at the moment...
Reply With Quote
  #5  
Old 10-01-2010, 08:15 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK Try this:

1. Create a phrase for your error message text and for Phrase Type choose "Error Messages". Let's say the varname is must_use_hide (or if you use something else, also change it in the code below).

2. Create a plugin using the newpost_process hook with this code:

PHP Code:
if (!preg_match('|\[HIDE].+\[/HIDE]|'$post['message']))
{
   
$dataman->error('must_use_hide');

I tested it a little but I hate doing regular expressions so it may not be 100% correct, so maybe BirdOfPrey has a good way to check for HIDE tags.
Reply With Quote
  #6  
Old 10-01-2010, 10:54 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'm sure your method is more efficient, I was just going to search for the closing tag because if they use that they probably use the opening too but your implementation is better.
Reply With Quote
  #7  
Old 10-02-2010, 11:30 AM
Dj Smuggla Dj Smuggla is offline
 
Join Date: Sep 2009
Posts: 148
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks guys for taking a look...

kh99 that works great m8 , but how do you add more of these:
''|\[HIDE].+\[/HIDE]|','

Because right now i have to use the hide in caps like in the code above.

Is it possible to add:
[hide]
[hiDE]

One last thing, how can i use it only in a certain set of forums, not every forum.

Thanks again m8, gud stuff...
Reply With Quote
  #8  
Old 10-02-2010, 12:07 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For the hide, HiDe, etc issue, you just need to add an 'i' at the end of the pattern. You have access to the $foruminfo, so if you want to do it only for certain forums you can check $foruminfo['forumid']. There was one other problem in the above: newpost_process is actually called for all posts and not just new threads, so there needs to be a check for that.

PHP Code:
if ($type == 'thread' AND in_array($foruminfo['forumid'], array(123)))
{
   if (!
preg_match('|\[HIDE].+\[/HIDE]|i'$post['message'])) 
   { 
      
$dataman->error('must_use_hide'); 
   }

Of course you want to replace the 1, 2, 3 list with your list of fourm ids. If there's some other forum option to check you might be able to do that instead of checking for certain ids.
Reply With Quote
  #9  
Old 10-02-2010, 12:19 PM
Dj Smuggla Dj Smuggla is offline
 
Join Date: Sep 2009
Posts: 148
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks a million kh99, that worked perfect m8...

That'll save me & my mods a lot of time editing posts...
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 08:25 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.03843 seconds
  • Memory Usage 2,259KB
  • Queries Executed 12 (?)
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
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (1)postbit_attachment
  • (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_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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete