Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 09-09-2011, 01:28 AM
DNCL DNCL is offline
 
Join Date: Jul 2011
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default BBCode Hide for VB4

Hello,

i need a full functional mod to hide [CODE] or other bbcode contents for a specific group, i have one but for some odd reason it hides the content for other groups too.

Is there a real working one for VB4?

Note: i don't want [ HIDE] [/HIDE ] hack.
Reply With Quote
  #2  
Old 09-09-2011, 01:15 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DNCL View Post
Hello,

i need a full functional mod to hide [CODE] or other bbcode contents for a specific group, i have one but for some odd reason it hides the content for other groups too.
That may be due to post caching. The way things are set up, vb assumes that bbcodes will look the same for everyone viewing a specific style.


Quote:
Note: i don't want [ HIDE] [/HIDE ] hack.

Why not? Is it not what you're asking for, or you don't like it for some other reason?
Reply With Quote
  #3  
Old 09-09-2011, 02:56 PM
DNCL DNCL is offline
 
Join Date: Jul 2011
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i have an already posts coded with [CODE] and i just want to hide them.
Reply With Quote
  #4  
Old 09-09-2011, 03:57 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, well I guess you could do something like this: edit the template bbcode_code (and maybe bbcode_code_printable as well), and add comments like this:

Code:
<!-- code -->
existing template code
<!-- end code -->

Then create a plugin using hook postbit_display_complete and something like this for code:

PHP Code:
global $vbulletin;

if (
is_member_of($vbulletin->userinfo1234))
{
    
$post['message'] = preg_replace('#<!-- code -->.*?<!-- end code -->#s''(Code Removed)'$post['message']);


(of course you can change the usergroup ids and '(Code Removed)' string to whatever you want).

Edit: Actually this doesn't work perfectly. If the code happens to contain <!-- end code --> you'll still see everything after that.
Reply With Quote
Благодарность от:
DNCL
  #5  
Old 09-09-2011, 04:34 PM
DNCL DNCL is offline
 
Join Date: Jul 2011
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This worked for me i guess but is this method works 100% and no caching issues for example?
Reply With Quote
  #6  
Old 09-09-2011, 04:43 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DNCL View Post
This worked for me i guess but is this method works 100% and no caching issues for example?
Yes, it happens after the caching so it should be OK (of course now it has to run a preg_replace on every post, but you can't have everything). And like I mentioned above it potentially would mess up if the code included one of those comments, but you change them to something even less likely to appear by accident.
Reply With Quote
  #7  
Old 09-09-2011, 05:03 PM
DNCL DNCL is offline
 
Join Date: Jul 2011
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can i parse bbcode in the message (Code Removed) ?
Reply With Quote
  #8  
Old 09-09-2011, 05:25 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, it has to be html. But you could probably render a template, like:

PHP Code:
if (is_member_of($vbulletin->userinfo1234)) 

    static 
$code_replacement '';
    if (empty(
$code_replacement))
    {
        
$templater vB_Template::create('code_replacement');
        
$code_replacement $templater->render();
        unset(
$templater);
    }
    
$post['message'] = preg_replace('#<!-- code -->.*?<!-- end code -->#s'$code_replacement$post['message']); 


That doesn't let you use bbcode, but it's a little more convenient. I suppose you could run the replacement text through the bbcode parser if you wanted, but it really doesn't let you do anything you couldn't do by inserting html.
Reply With Quote
  #9  
Old 09-09-2011, 05:44 PM
DNCL DNCL is offline
 
Join Date: Jul 2011
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the HTML tags works with the first plugin you gave me, anything special wit the second one?
Reply With Quote
  #10  
Old 09-09-2011, 05:49 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, it just lets you put the html in a template but you don't need to do that.
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 04:55 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.05982 seconds
  • Memory Usage 2,259KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete