vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Registered user view Code (https://vborg.vbsupport.ru/showthread.php?t=129433)

nishv 10-19-2006 12:37 AM

Registered user view Code
 
I am trying to make my vB to disallow Guests to see contents wrapped in CODE...

Any idea how this can be done?

G0F0RBR0KE 10-19-2006 02:01 AM

I think it's in the UserGroup Manager (check the guests)

nishv 10-19-2006 02:02 AM

No its not. Well, As far as I can see... :knockedout:

G0F0RBR0KE 10-19-2006 02:11 AM

I'll see what i can find.

Ntfu2 10-19-2006 04:29 AM

You'll have to edit the bbcode_code template, i think thats what its called

Adrian Schneider 10-19-2006 04:31 AM

Here's what I did on my site....
Quote:

I have it working for PHP on my board...

The problem is that posts are cached, meaning if you post it in style#1 as an administrator, it will be parsed and stored in the database (exactly what you saw for a given style). That condition no longer exists when you view it a second time. Kind of defeats the purpose of the templates, but oh well.

In the PHP bbcode template, there are comments you can use as reference points to alter the contents... Here is what I'm using:

PHP Code:

if (THIS_SCRIPT == 'showpost' or THIS_SCRIPT == 'showthread')
{
    global 
$foruminfo;

    if (
        
in_array($foruminfo['forumid'], array(12345)) and
        
strpos($output'<!-- php') !== false and
        !
is_member_of($vbulletin->userinfo5610)
    )
    {
        
$pattern '/<!-- php buffer start --><code>(.*?)<\/code><!-- php buffer end -->/s';
        
$output preg_replace($pattern'<span class="semihighlight">Only licensed users can view PHP code!</span>'$output);
    }


It can probably be altered to run in the postbit factory, but I don't have time to mess around and get it as fast as possible. You'll have to alter the forumids, usergroupids, and also the replace text because that CSS class won't exist for you.

Using some common sense and copy pasting, you should be able to get it working for all of the templates (though you'll have to edit them).

- If anyone knows a better method let me know, because this isn't exactly an elegant work around.

harmor19 10-19-2006 07:01 PM

You can just edit the template.

ACP --> BB Code Layout --> bbcode_code

Change to
PHP Code:

<if condition="is_member_of($bbuserinfo[usergroupid], 6,15) AND in_array($foruminfo[forumid], 5,7,8)">
<
div style="margin:20px; margin-top:5px">
    <
div class="smallfont" style="margin-bottom:2px">$vbphrase[code]:</div>
    <
pre class="alt2" style="margin:0px; padding:$stylevar[cellpadding]px; border:1px inset; width:$stylevar[codeblockwidth]; height:{$blockheight}px; overflow:auto"><div dir="ltr" style="text-align:left;">$code</div></pre>
</
div>
<else />
<
div style="margin:20px; margin-top:5px">
    <
div class="smallfont" style="margin-bottom:2px">$vbphrase[code]:</div>
    <
pre class="alt2" style="margin:0px; padding:$stylevar[cellpadding]px; border:1px inset; width:$stylevar[codeblockwidth]; height:{$blockheight}px; overflow:auto"><div dir="ltr" style="text-align:left;">Only licensed users can view PHP code!</div></pre>
</
div>
</if> 

This is untested

Adrian Schneider 10-19-2006 07:50 PM

Until the post gets cached and it only works for yourself. ;)

Maybe there is a way to disable caching on certain posts...


All times are GMT. The time now is 06:39 AM.

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.01003 seconds
  • Memory Usage 1,742KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete