View Full Version : 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.
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.
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?
i have an already posts coded with [CODE] and i just want to hide them.
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 -->
existing template code
<!-- end code -->
Then create a plugin using hook postbit_display_complete and something like this for code:
global $vbulletin;
if (is_member_of($vbulletin->userinfo, 1, 2, 3, 4))
{
$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.
This worked for me i guess but is this method works 100% and no caching issues for example?
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.
can i parse bbcode in the message (Code Removed) ?
No, it has to be html. But you could probably render a template, like:
if (is_member_of($vbulletin->userinfo, 1, 2, 3, 4))
{
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.
the HTML tags works with the first plugin you gave me, anything special wit the second one?
No, it just lets you put the html in a template but you don't need to do that.
Thank you very much, i will be using your plugin for a while now, hope it serve me well on the long run :)
Easy5s.net
05-13-2012, 12:22 PM
Show at me is used mod this:
https://vborg.vbsupport.ru/showthread.php?t=271979
but when search showpost then output is not hidden be, me could not be hook to use do not plug at here
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.