Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

Reply
 
Thread Tools
Restrict [code] and [php] to registered members only Details »»
Restrict [code] and [php] to registered members only
Version: 1.00, by Dean C Dean C is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 11-03-2003 Last Update: Never Installs: 3
 
No support by the author.

Hi,

Long time since I release a hack and this was only a little one I brushed up. Still useful nevertheless.

What does it do?
It allows you to restrict the content of the [ php] and [ code] tags to registered members only. If the user is not registered then they get a 'Sorry you must be registered to view this code.' displayed in the boxes

Instructions:

In admin/functions.php find:

PHP Code:
return "</normalfont><blockquote><code><smallfont>PHP:</smallfont><hr>$buffer<hr></code></blockquote><normalfont>"
Replace with:

PHP Code:
if($bbuserinfo['userid'] != 0)

{

    
$newbuffer $buffer;

}

else

{

    
$newbuffer 'Sorry you must be registered to view this code.';

}

return 
"</normalfont><blockquote><pre><smallfont>PHP:</smallfont><hr>$newbuffer<hr></pre></blockquote><normalfont>";

Find:

PHP Code:
return "</normalfont><blockquote><pre><smallfont>code:</smallfont><hr>" str_replace("<br>"""str_replace("<br />"""$foundcode) ) . "<hr></pre></blockquote><normalfont>"
Replace with:

PHP Code:

if($bbuserinfo['userid'] != 0)

{

      
$newfoundcode $foundcode;

}

else

{

      
$newfoundcode 'Sorry you must be registered to view this code.';
}
  
return 
"</normalfont><blockquote><pre><smallfont>code:</smallfont><hr>" str_replace("<br>"""str_replace("<br />"""$newfoundcode) ) . "<hr></pre></blockquote><normalfont>"
Find:

PHP Code:
function stripbrsfromcode($foundcode) { 
Below it add:
PHP Code:
global $bbuserinfo
Find:

PHP Code:
function phphighlite($code) { 
Below it add:

PHP Code:
global $bbuserinfo
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+

In search.php find:

PHP Code:
$searchresult[posttitle]=str_replace("<","&lt;",$searchresult[posttitle]); 
Below it add:

PHP Code:
if($bbuserinfo['userid'] == 0)
{
    
$searchresult['pagetext'] = preg_replace('#\[(php|code)](\r\n)*(.*)\[/\1]#''[$1]Sorry you must be registered to view this code[/$1]'$searchresult['pagetext']);

---------------------
Enjoy !
- Dean

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 11-04-2003, 05:40 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice job ^^ now fix the bug
Reply With Quote
  #3  
Old 11-04-2003, 05:42 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Already did it ^^
Reply With Quote
  #4  
Old 11-04-2003, 05:55 PM
Rampag33's Avatar
Rampag33 Rampag33 is offline
 
Join Date: Jun 2002
Location: Houston, Texas
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Mist does it again
Reply With Quote
  #5  
Old 11-04-2003, 06:49 PM
gmarik's Avatar
gmarik gmarik is offline
 
Join Date: May 2002
Location: Mocsow
Posts: 1,288
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Mist - wow.
But have you done it working, so you we can use real workin php code in vB 2 templates? No hack worked for me. How is it with you?
Reply With Quote
  #6  
Old 11-04-2003, 07:15 PM
cirisme cirisme is offline
 
Join Date: Jan 2003
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

kind of like vb.org not displaying code boxes to unliscensed members?
Reply With Quote
  #7  
Old 11-04-2003, 09:27 PM
ap0c's Avatar
ap0c ap0c is offline
 
Join Date: Mar 2003
Posts: 210
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice and useful mist, thanks
Reply With Quote
  #8  
Old 11-04-2003, 11:32 PM
t c t c is offline
 
Join Date: Oct 2003
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Mist, about a hack extremely similar to this?

Making the php & code tags viewable in only certain forums and not viewable in the rest.

Is this possible?
Reply With Quote
  #9  
Old 11-05-2003, 12:15 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice hack Dean ^^

no fix the bugs of showing codes in search as posts and quoting msgs

if you done so, i'll give you the vb2 code we used at vb.org
Reply With Quote
  #10  
Old 11-05-2003, 06:33 AM
t c t c is offline
 
Join Date: Oct 2003
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Weird issue, null, the owner of the board I am Admin of installed this and it removed the usernames from the postbit. We are using vb 2.3.2
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:36 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.04640 seconds
  • Memory Usage 2,309KB
  • Queries Executed 25 (?)
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
  • (10)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete