Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-31-2014, 03:51 PM
Jo_RHU Jo_RHU is offline
 
Join Date: Jan 2010
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Hide content within a bbcode from certain usergroups

I know this has been asked before but it doesn't seem like there is a solution (or if there is, it's pretty complicated and the solution hasn't been posted in full, and any mods that claim to do this seem to have a lot of problems).

Is there any way to have a bbcode, for example [PRIVATE]my text here[/PRIVATE] which could be set up so that only users in X, Y & Z usergroups can view when they're parsed on the front end? (Like vb.org hides code from unregistered users)

I realise (after much searching) that it's not possible to simply put a conditional within the bbcode HTML. I also considered a replacement variable but of course that doesn't work either.

I don't suppose there's any way to use a conditional in the bbcode style template? Like IF it's bbcode id #9, show this, IF not show this. I guess it can't be that simple or someone would have mentioned it on the 30+ threads I just hunted through!

Perhaps there's some sort of magical javascript that could do this based on the style name of the div/span id or class? For example, I make a bbcode that contains the HTML <span class="hidethis">{PARAM}</span>, then in the javascript include the code to hide content within that span from certain usergroups....

Any suggestions would be greatly appreciated.


eta:

Or perhaps someone could expand on this method? https://vborg.vbsupport.ru/showthread.php?t=212048

I've not created my own vb plugin before so a bit unsure on this process.
Reply With Quote
  #2  
Old 07-31-2014, 04:05 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There's a mod here that does this: https://vborg.vbsupport.ru/showthread.php?t=266744 but the free version only does it for the CODE tag, and it looks like maybe the premium version isn't being sold any more? At least I couldn't find a link to it, or find it on his site. (ETA: he has in fact announced on his site that he is no longer offering premium vbulletin mods.)

If you can do some coding you might be able to figure out how it works and write your own.

The javascript idea might work, unless you really want to keep some people from seeing the content, because people will figure out to disable javascript or just view the html source.

I think it's not too hard to provide php to handle a bbcode tag, but you also have to make sure the result doesn't get cached (I think I asked nhawk about that in his mod thread). Edit: does vb3 cache posts or is that just vb4? I don't remember.
Reply With Quote
Благодарность от:
Jo_RHU
  #3  
Old 07-31-2014, 04:11 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Jo_RHU View Post
eta:

Or perhaps someone could expand on this method? https://vborg.vbsupport.ru/showthread.php?t=212048

I've not created my own vb plugin before so a bit unsure on this process.
There's this mod: https://vborg.vbsupport.ru/showthread.php?t=264898 but again, there's the caching issue (i'ts mentioned in the thread).
Reply With Quote
  #4  
Old 08-01-2014, 09:39 AM
Jo_RHU Jo_RHU is offline
 
Join Date: Jan 2010
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
There's a mod here that does this: https://vborg.vbsupport.ru/showthread.php?t=266744 but the free version only does it for the CODE tag, and it looks like maybe the premium version isn't being sold any more? At least I couldn't find a link to it, or find it on his site. (ETA: he has in fact announced on his site that he is no longer offering premium vbulletin mods.)

If you can do some coding you might be able to figure out how it works and write your own.
Fantastic, this is working Thanks so much (don't know how I missed that one whilst searching, I guess just searching 'hide' instead of 'hider')

For anyone else interested, I just changed every instance of (without the spaces):

[ code ] & [ /code ] to [ private ] & [ /private ]
[ CODE ] & [ /CODE ] to [ PRIVATE ] & [ /PRIVATE ]
[ newcode ] & [ /newcode ] to [ newprivate ] & [ /newprivate ]
[ NEWCODE ] & [NEWCODE ] to [ NEWPRIVATE ] & [ /NEWPRIVATE ]

then because the plugin uses character stripping, had to change instances of '+ 7' to '+ 10' to match the word length, so increase or decrease this number as per the number of characters in your bbcode (the original was CODE, and it used +7, so you want to use your number of characters +3)

Then upload, edit the settings in the Options menu and you're done Awesome.

I want to also try and have the bbcode viewable by the thread starter so I'm going to attempt to just add a conditional for this wherever the conditional for usergroups is within the plugin, so wherever it says this:
Code:
if($vbulletin->options['bbchide_code'] && is_member_of($vbulletin->userinfo, explode(',', $vbulletin->options['bbchide_code_usergroups'])))

eta: updated as I forgot to include the [ newcode ] bits to change
Reply With Quote
Благодарность от:
blind-eddie
Reply


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 12:22 PM.


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.03506 seconds
  • Memory Usage 2,204KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)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
  • (2)post_thanks_postbit
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (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
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete