The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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. |
#2
|
|||
|
|||
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. |
Благодарность от: | ||
Jo_RHU |
#3
|
|||
|
|||
Quote:
|
#4
|
|||
|
|||
Quote:
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 |
Благодарность от: | ||
blind-eddie |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|