Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 02-25-2009, 12:09 PM
Triky's Avatar
Triky Triky is offline
 
Join Date: Mar 2007
Location: [Italy]
Posts: 728
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [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?
Reply With Quote
  #2  
Old 02-25-2009, 05:43 PM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #3  
Old 02-26-2009, 05:44 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #4  
Old 02-26-2009, 10:29 AM
Triky's Avatar
Triky Triky is offline
 
Join Date: Mar 2007
Location: [Italy]
Posts: 728
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #5  
Old 02-27-2009, 08:14 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Triky View Post
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 View Post
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? ). 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.
Reply With Quote
  #6  
Old 02-28-2009, 11:57 AM
Triky's Avatar
Triky Triky is offline
 
Join Date: Mar 2007
Location: [Italy]
Posts: 728
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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']
    ); 
Reply With Quote
  #7  
Old 02-28-2009, 12:16 PM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, that is not what I am talking about. Look at the end of class_bbcode.php.
Reply With Quote
  #8  
Old 02-28-2009, 04:48 PM
Triky's Avatar
Triky Triky is offline
 
Join Date: Mar 2007
Location: [Italy]
Posts: 728
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #9  
Old 03-02-2009, 05:16 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
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).
.
Reply With Quote
  #10  
Old 03-02-2009, 07:09 AM
Triky's Avatar
Triky Triky is offline
 
Join Date: Mar 2007
Location: [Italy]
Posts: 728
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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/.
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 01:11 PM.


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.04252 seconds
  • Memory Usage 2,261KB
  • Queries Executed 13 (?)
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_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
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (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_postinfo_query
  • fetch_postinfo
  • 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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete