Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
Hide [code],[html],[php] BBCode from Unregistered/Unverified Details »»
Hide [code],[html],[php] BBCode from Unregistered/Unverified
Version: 1.00, by Kelvin Yong Kelvin Yong is offline
Developer Last Online: Jun 2015 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 4.2.2 Rating:
Released: 06-15-2015 Last Update: Never Installs: 8
Uses Plugins Template Edits
Re-useable Code  
No support by the author.

I have searched for such mod on the forums and couldn't find a fully functional one - either due to post cache issue or etc.

I have created something similar and fully functional without any cache issue based on kh99's (moderator at vb.org) idea. This is my first release on this forum so hope that you guys don't go hard on me.



Features:
  • Hide [code], [html] and [php] from Unregistered/Unverified account.
  • Works on all normal postbit, printable view & mobile style.

Installation:
1) Go to AdminCP -> Styles & Templates -> Style Manager -> *PRIMARY PARENT STYLE* -> Expand Template
2) Select BB Code Layout Templates -> Replace bbcode_code with the following:

HTML Code:
<!-- START PRIVATE BBCODE -->
<div class="bbcode_container">
	<div class="bbcode_description">{vb:rawphrase code}:</div>
	<pre class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']"> style="height:<vb:if condition="$blockheight<$vboptions['codemaxlines']">{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}*2}<vb:else />{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>>{vb:raw code}</pre>
</div>
<!-- END PRIVATE BBCODE -->
3) Replace bbcode_code_printable with the following:

HTML Code:
<!-- START PRIVATE P_BBCODE -->
<div class="bbcode_container">
	<div class="bbcode_description">{vb:rawphrase code}:</div>
	<hr /><code class="bbcode_code">{vb:raw code}</code><hr />
</div>
<!-- END PRIVATE P_BBCODE -->
4) Replace bbcode_html with the following:

HTML Code:
<!-- START PRIVATE BBCODE -->
<div class="bbcode_container">
	<div class="bbcode_description">{vb:rawphrase html_code}:</div>
	<pre class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']"> style="height:<vb:if condition="$blockheight<=$vboptions['codemaxlines']">{vb:math {vb:math {vb:raw blockheight}+2}}*{vb:stylevar mid_fontSize}}<vb:else />{vb:math {vb:math {vb:raw blockheight}+1}*{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>>{vb:raw code}</pre>
</div>
<!-- END PRIVATE BBCODE -->
5) Replace bbcode_html_printable with the following:

HTML Code:
<!-- START PRIVATE P_BBCODE -->
<div class="bbcode_container">
	<div class="bbcode_description">{vb:rawphrase html_code}:</div>
	<hr /><code class="bbcode_code">{vb:raw code}</code><hr />
</div>
<!-- END PRIVATE P_BBCODE -->
6) Replace bbcode_php with the following:

HTML Code:
<!-- START PRIVATE BBCODE -->
<div class="bbcode_container">
	<div class="bbcode_description">{vb:rawphrase php_code}:</div>
	<div class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']"> style="height:<vb:if condition="$blockheight<$vboptions['codemaxlines']">{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}*2}<vb:else />{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>><code>{vb:raw code}</code></div>
</div>
<!-- END PRIVATE BBCODE -->
7) Replace bbcode_php_printable with the following:

HTML Code:
<!-- START PRIVATE P_BBCODE -->
<div class="bbcode_container">
	<div class="bbcode_description">{vb:rawphrase php_code}:</div>
	<hr /><code class="bbcode_code">{vb:raw code}</code><hr />
</div>
<!-- END PRIVATE P_BBCODE -->
8) Select *PRIMARY MOBILE STYLE* -> Expand Template -> BB Code Layout Templates
9) Replace bbcode_code with the following:

HTML Code:
<!-- START PRIVATE M_BBCODE -->
<div class="bbcode_container">
	<div class="bbcode_description">{vb:rawphrase code}: [<a href="#" class="view">{vb:rawphrase view}</a>]</div>
	<pre class="bbcode_code">{vb:raw code}</pre>
</div>
<!-- END PRIVATE M_BBCODE -->
10) Replace bbcode_html with the following:

HTML Code:
<!-- START PRIVATE M_BBCODE -->
<div class="bbcode_container">
	<div class="bbcode_description">{vb:rawphrase html_code}: [<a href="#" class="view">{vb:rawphrase view}</a>]</div>
	<pre class="bbcode_code">{vb:raw code}</pre>
</div>
<!-- END PRIVATE M_BBCODE -->
11) Replace bbcode_php with the following:

HTML Code:
<!-- START PRIVATE M_BBCODE -->
<div class="bbcode_container">
	<div class="bbcode_description">{vb:rawphrase php_code}: [<a href="#" class="view">{vb:rawphrase view}</a>]</div>
	<div class="bbcode_code"><code>{vb:raw code}</code></div>
</div>
<!-- END PRIVATE M_BBCODE -->
12) Now we're done with the template modification, we'll now move on to plugin.
13) Select Plugins & Products -> Add New Plugin for the normal postbit with the following:

PHP Code:
ProductvBulletin
Hook Location
postbit_display_complete
Title
: Private BBCode Unregistered/Unverified
Plugin PHP Code
:

global 
$vbulletin;

static 
$unregistered_code_replacement '
    <div class="bbcode_container">
        <div class="bbcode_description" style="padding-bottom: 2px;"><b>Block Disabled:</b> please <a href="register.php">register</a> or <a href="#login-box" class="login-window">login</a> to view this content.</div>
        <pre class="bbcode_code">Unregistered or guests cannot view this content.</pre>
    </div>'
;
static 
$unverified_code_replacement '
    <div class="bbcode_container">
        <div class="bbcode_description" style="padding-bottom: 2px;"><b>Block Disabled:</b> request <a href="register.php?do=requestemail">activation</a> or <a href="sendmessage.php">contact us</a></div>
        <pre class="bbcode_code">Unverified account cannot view this content.</pre>
    </div>'
;

if (
is_member_of($vbulletin->userinfo1)) {
    
$post['message'] = preg_replace('#<!-- START PRIVATE BBCODE -->.*?<!-- END PRIVATE BBCODE -->#s'$unregistered_code_replacement$post['message']);
}
if (
is_member_of($vbulletin->userinfo34)) {
    
$post['message'] = preg_replace('#<!-- START PRIVATE BBCODE -->.*?<!-- END PRIVATE BBCODE -->#s'$unverified_code_replacement$post['message']);

14) Add New Plugin for the mobile style with the following:

PHP Code:
ProductvBulletin
Hook Location
postbit_display_complete
Title
: Private BBCode Unregistered/Unverified (M)
Plugin PHP Code:

global 
$vbulletin;

static 
$unregistered_code_replacement '
    <div class="bbcode_container">
        <div class="bbcode_description" style="padding-bottom: 2px;"><b>Block Disabled:</b> [<a href="#" class="view">View</a>]</div>
        <pre class="bbcode_code">Unregistered or guests cannot view this content.</pre>
    </div>'
;
static 
$unverified_code_replacement '
    <div class="bbcode_container">
        <div class="bbcode_description" style="padding-bottom: 2px;"><b>Block Disabled:</b> [<a href="#" class="view">View</a>]</div>
        <pre class="bbcode_code">Unverified account cannot view this content.</pre>
    </div>'
;

if (
is_member_of($vbulletin->userinfo1)) {
    
$post['message'] = preg_replace('#<!-- START PRIVATE M_BBCODE -->.*?<!-- END PRIVATE M_BBCODE -->#s'$unregistered_code_replacement$post['message']);
}
if (
is_member_of($vbulletin->userinfo34)) {
    
$post['message'] = preg_replace('#<!-- START PRIVATE M_BBCODE -->.*?<!-- END PRIVATE M_BBCODE -->#s'$unverified_code_replacement$post['message']);

14) Add New Plugin for the printable view with the following:

PHP Code:
ProductvBulletin
Hook Location
printthread_post
Title
: Private BBCode Unregistered/Unverified (P)
Plugin PHP Code:

global 
$vbulletin;

static 
$unregistered_code_replacement '
    <div class="bbcode_container">
        <div class="bbcode_description" style="padding-bottom: 2px;"><b>Block Disabled:</b></div>
        <hr /><code class="bbcode_code">Unregistered or guests cannot view this content.</code><hr />
    </div>'
;
static 
$unverified_code_replacement '
    <div class="bbcode_container">
        <div class="bbcode_description" style="padding-bottom: 2px;"><b>Block Disabled:</b></div>
        <hr /><code class="bbcode_code">Unverified account cannot view this content.</code><hr />
    </div>'
;

if (
is_member_of($vbulletin->userinfo1)) {
    
$post['message'] = preg_replace('#<!-- START PRIVATE P_BBCODE -->.*?<!-- END PRIVATE P_BBCODE -->#s'$unregistered_code_replacement$post['message']);
}
if (
is_member_of($vbulletin->userinfo34)) {
    
$post['message'] = preg_replace('#<!-- START PRIVATE P_BBCODE -->.*?<!-- END PRIVATE P_BBCODE -->#s'$unverified_code_replacement$post['message']);

15) DONE.

Now the [code],[html],[php] BBCode should be hidden from unregistered and unverified accounts - of course, feel free to alter the codes above to match your needs.

Have a great day.

Screenshots

File Type: png Screen Shot 2015-06-16 at 9.08.29 pm.png (52.9 KB, 0 views)
File Type: jpg Screen Shot 2015-06-16 at 9.08.41 pm.jpg (23.9 KB, 0 views)
File Type: jpg Screen Shot 2015-06-16 at 9.09.17 pm.jpg (23.5 KB, 0 views)

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
2 благодарности(ей) от:
puertoblack2003, sodasusu

Comments
  #2  
Old 07-19-2015, 05:19 PM
Golzarion's Avatar
Golzarion Golzarion is offline
 
Join Date: Jan 2008
Posts: 214
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice work !
Reply With Quote
  #3  
Old 07-19-2015, 06:03 PM
Raptor Raptor is offline
 
Join Date: Nov 2001
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I found this works much better - a simple plugin - works with all custom bbcodes, signatures and usergroups too

https://vborg.vbsupport.ru/showthread.php?t=318467
Reply With Quote
  #4  
Old 10-08-2015, 08:20 AM
friendlymela's Avatar
friendlymela friendlymela is offline
 
Join Date: Dec 2012
Location: Karachi, Pakistan
Posts: 272
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

how should i can hide keywords
Reply With Quote
Reply

Thread Tools

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 07:39 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.10352 seconds
  • Memory Usage 2,301KB
  • Queries Executed 21 (?)
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
  • (9)bbcode_html
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (2)post_thanks_box_bit
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_attachment
  • (4)postbit_onlinestatus
  • (4)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • 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
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete