vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   [code] tag for registrered members only (https://vborg.vbsupport.ru/showthread.php?t=206558)

Triky 02-25-2009 12:09 PM

[code] tag for registrered members only
 
Hey there, doing this:

Template: bbcode_code
Code:

<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">$vbphrase['code']:</div>
    <pre class="alt2" dir="ltr" style="
        margin: 0px;
        padding: $stylevar[cellpadding]px;
        border: 1px inset;
        width: $stylevar[codeblockwidth];
        height: {$blockheight}px;
        text-align: left;
        overflow: auto"><if condition="$show['guest']">Please sign up<else />$code</if></pre>
</div>

I can't get it work. Can you please give me some advice?

TigerC10 02-25-2009 05:43 PM

Have you tried taking out the quotes around guest?

Code:

<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">$vbphrase['code']:</div>
    <pre class="alt2" dir="ltr" style="
        margin: 0px;
        padding: $stylevar[cellpadding]px;
        border: 1px inset;
        width: $stylevar[codeblockwidth];
        height: {$blockheight}px;
        text-align: left;
        overflow: auto"><if condition="$show[guest]">Please sign up<else />$code</if></pre>
</div>


Dismounted 02-26-2009 05:44 AM

Posts are (usually) cached - and therefore, all BB code is translated into HTML on the first view of the post (and on subsequent cache refreshes). Turn off post caching (will increase load on your server).

Triky 02-26-2009 10:29 AM

TigerC10: No, it doesn't work.
Dismounted: Where do I disable post caching? I have tried to set up this:

admincp -> vb options -> server settings & optimization options ->
Cached Posts Lifespan

.. to 0. But it doesn't work. Viewing my thread as guest it still show the code.

Anyway, then.. how would I go to edit it in order to be viewed also when post caching is on?

Dismounted 02-27-2009 08:14 AM

Quote:

Originally Posted by Triky (Post 1755092)
Where do I disable post caching? I have tried to set up this:

admincp -> vb options -> server settings & optimization options ->
Cached Posts Lifespan

.. to 0. But it doesn't work. Viewing my thread as guest it still show the code.

My guess is that the variable is not inside scope. What you need to do is to create your own parser based on the one readily defined (search for it, I have posted how to create custom BB codes that use PHP).
Quote:

Originally Posted by Triky (Post 1755092)
Anyway, then.. how would I go to edit it in order to be viewed also when post caching is on?

That's tricky (get it? :D). I have not actually looked into it, but it would probably require some sort of doing the "Code" BB code replacement last minute, and disabling the parsing of it beforehand.

Triky 02-28-2009 11:57 AM

Mhh, maybe I should try to edit this part of code in includes/functions.php?

PHP Code:

    $vbulletin->bbcode_style = array(
        
'code'  => &$templateassoc['bbcode_code_styleid'],
        
'html'  => &$templateassoc['bbcode_html_styleid'],
        
'php'   => &$templateassoc['bbcode_php_styleid'],
        
'quote' => &$templateassoc['bbcode_quote_styleid']
    ); 


Dismounted 02-28-2009 12:16 PM

No, that is not what I am talking about. Look at the end of class_bbcode.php.

Triky 02-28-2009 04:48 PM

Then you mean this?
PHP Code:

        if (($vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_CODE) OR $force_all)
        {
            
//[CODE]
            
$tag_list['no_option']['code'] = array(
                
'callback' => 'handle_bbcode_code',
                
'strip_empty' => true,
                
'disable_smilies' => true,
                
'disable_wordwrap' => true,
                
'strip_space_after' => 2
            
);
        } 

But.. how should I go trought editing that? Can you please help me Dismounted?

Dismounted 03-02-2009 05:16 AM

Quote:

Originally Posted by Dismounted (Post 1755825)
What you need to do is to create your own parser based on the one readily defined (search for it, I have posted how to create custom BB codes that use PHP).

:).

Triky 03-02-2009 07:09 AM

I would like to use the [code], [php] and [html] standard tags.
Anyway, I have just found this one: http://www.vbhackers.com/f76/hide-code-usergroups-5884/.


All times are GMT. The time now is 11:14 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.01512 seconds
  • Memory Usage 1,744KB
  • 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_code_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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