Thread: Administrative and Maintenance Tools - Advanced BBCode Permissions
View Single Post
  #244  
Old 07-05-2009, 05:13 PM
inciarco's Avatar
inciarco inciarco is offline
 
Join Date: Mar 2007
Posts: 758
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've Just Figured that the Previous Code for the BBCodes is for Disabling the Parsing Options when the BBCode is Being Posted, but Not to Avoid Viewing it; to Disable the Display of Custom BBCodes on Posts you should do the Following.

There should be some Extra Code that can be Removed from the Following Code Lines, but as I'm Not a Coder I Can't Optimize it; if You Find a Way to Remove the Extra Code that isn't needed, it'll be Just Great that You Post Your Solution Here for Everybody to Benefit.

First Step:

First You Need to Add at the Beginning of Each Custom BBCode You Wish to Restrict Viewind/Displaying the Following Text

Quote:
<div id="private_bbcode">
and Add at the End of Each Custom BBCode You Added the Previous "div" Opening Tag Code.

Quote:
</div>
to Close the "div" Tag.

Again, this Uses a small part of the Code of the Mod from Cybernetec "Advanced Permissions Based on Post Count", and Found on the Plugin "Cyb - APBOUPC - P2 (PB)", the Code needed to Disable Images and Links in Posts and in Signatures; I Edited the Code to Leave Only the Code Lines to Remove BBCodes, (it was an Test and Error process because I'm not a Coder), and I Found that it can be done with the Help of that Useful Code from Cybernetec, (all Credits are His).

This Can be Included in the Plugin I Posted Just Above "BBCode Permissions For Usergroups - IMG - postbit_display_complete", because it uses the same vBulletin Hook.

Second Step:

Create a Plugin.

Product: vBulletin
Hook Place: postbit_display_complete
Title: BBCode Permissions For Usergroups - Custom BBCodes - postbit_display_complete
(or the Title that you wish)
Plugin Active: Yes
PHP Code:

Code:
if (is_member_of($this->registry->userinfo, 1,3,4,8))

{


					$this->post['message'] = preg_replace('!(<div id="private_bbcode">)(.*)(<\/div>)|[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b!siU', construct_phrase('<br />[[To See BbCodes in Posts You Must Register and Activate Your Account]]<br />', $forum[linkview_nb], $cyb_apboupc_viewlinks_userpostsnr), $this->post['message'].' ');


}
-1. Edit the usergroups 1,3,4,8 for the Ones You Wish that Can't See Custom BBCodes.

-2. Edit the Text of [[To See BBCodes in Posts You Must Register and Activate Your Account]], to the One you Wish Users of those Usergroups to See instead of the Custom BBCodes.

That's it. Enjoy.

My Best Regards.

Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01110 seconds
  • Memory Usage 1,778KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete