Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: ɔɔɔɔɔɔuɥoɾ on August 20, 2010, 02:55:28 AM

Title: Member Only BBC
Post by: ɔɔɔɔɔɔuɥoɾ on August 20, 2010, 02:55:28 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=2691)

This mod will allow you to easily hide any content in posts from guests using a bbc tag.
Title: Re: Member Only BBC
Post by: TASSADAR on January 19, 2011, 01:01:11 PM
Hello,

I've installed this mod on SMF 1.1.12, and it works very well, the only thing that goes wrong is that :

- If a link is inside the member only bbcode, it can't be clicked.
- Any other bbcode that is inside it, will be shown as text (no bbcode work inside it).

Please can anyone help !?  :'(
Title: Re: Member Only BBC
Post by: impreza on January 19, 2011, 06:12:35 PM
Very good, thanks
Title: Re: Member Only BBC
Post by: Perspective on January 19, 2011, 08:16:10 PM
Nice one, indeed.
I've just instaled it on SMF 1.1.12 aswell, but as the previous user said.. the link is not hyperlinked. Can you do something in order to solve this issue ? Also a text like Hidden for Guests displayed for Guest users only would be a +.
Thanks in advance !
Title: Re: Member Only BBC
Post by: TASSADAR on January 20, 2011, 06:51:23 AM
Hi,

For the text displayed for Guest users only, you can do :

./Sources/Subs.php

            array(
                'tag' => 'only_members',
                'type' => 'unparsed_content',
                'content' => $context['user']['is_logged'] ? '$1' :'ADD YOUR TEXT HERE',
            ),
Title: Re: Member Only BBC
Post by: Perspective on January 20, 2011, 07:50:04 AM
Quote from: TASSADAR on January 20, 2011, 06:51:23 AM
Hi,

For the text displayed for Guest users only, you can do :

./Sources/Subs.php

            array(
                'tag' => 'only_members',
                'type' => 'unparsed_content',
                'content' => $context['user']['is_logged'] ? '$1' :'ADD YOUR TEXT HERE',
            ),



Yaaay, it's working.
Thank you !
Title: Re: Member Only BBC
Post by: TASSADAR on January 21, 2011, 07:37:28 PM
Please, can anyone help for my first question !?  :'(
Title: Re: Member Only BBC
Post by: TASSADAR on March 20, 2011, 04:15:58 AM
No one can help !?  :(
Title: Re: Member Only BBC
Post by: Joker™ on March 20, 2011, 04:38:04 AM
Try this code (Make backup of your file before editing it)


Sources\Subs.php

Find:
            array(
                'tag' => 'only_members',
                'type' => 'unparsed_content',
                'content' => $context['user']['is_logged'] ? '$1' :'',
            ),




Replace it with:
            array(
                'tag' => 'only_members',
                'type' => 'unparsed_content',
                'content' => $context['user']['is_logged'] ? '$1' :'',
'validate' => create_function('&$tag, &$data, $disabled', '
if (isset($disabled[\'url\']))
$tag[\'content\'] = \'$1\';
elseif (strpos($data[0], \'http://\') !== 0 && strpos($data[0], \'https://\') !== 0)
$data[0] = \'http://\' . $data[0];
'),
            ),


I've not tested the code extensively.
Title: Re: Member Only BBC
Post by: TASSADAR on March 20, 2011, 12:27:56 PM
Sorry, but this code don't work, it only add an h at the begining of the url, example :

When i do this :
[only_members]www.google.com[/only_members]

It show this :
hww.google.com

The problem is that any bbcode inside the only_members tag don't work....  :-\

Thanks in advance for your help.
Title: Re: Member Only BBC
Post by: Joker™ on March 20, 2011, 02:33:46 PM
[only_members] tags don't work in [ code ] tags. I've tried it on my test forum and they are not getting parsed in [ code] tags.
Title: Re: Member Only BBC
Post by: Arantor on March 20, 2011, 02:37:16 PM
No, because the code tag rewrites everything in it except for the closing tag. (Much as the nobbc and html tags would do)

That's not avoidable without rewriting the entire parser, just put the code tags inside the members only tag.
Title: Re: Member Only BBC
Post by: TASSADAR on March 20, 2011, 05:02:53 PM
I've just used the code tag here to show you what i've done ^^ So even without the code tag the only_members tag disable all the bbcode inside it....  :-\
Title: Re: Member Only BBC
Post by: Joker™ on March 21, 2011, 02:52:18 AM
Quote from: TASSADAR on March 20, 2011, 05:02:53 PM
I've just used the code tag here to show you what i've done ^^ So even without the code tag the only_members tag disable all the bbcode inside it....  :-\
You said you installed the mod on SMF 1.1.12, whereas mod page says

Compatible With: 2.0 RC3
Title: Re: Member Only BBC
Post by: TASSADAR on March 21, 2011, 03:57:27 AM
Ok, so there is no solution to solve this issue !? or make it compatible with 1.1.13 !?  :-\
Title: Re: Member Only BBC
Post by: Joker™ on March 21, 2011, 07:13:24 AM
Quote from: TASSADAR on March 21, 2011, 03:57:27 AM
Ok, so there is no solution to solve this issue !? or make it compatible with 1.1.13 !?  :-\
Haven't got a chance to work on SMF 1.1.13 with this mod. If I get time I'll see what can I do for it.
Title: Re: Member Only BBC
Post by: TASSADAR on March 21, 2011, 07:42:48 AM
Ok, thanks a lot for your help, hope someone else can help us.
Title: Re: Member Only BBC
Post by: Joker™ on March 21, 2011, 09:10:41 AM
Tested the code I've posted above on SMF 1, and it seems to be working fine for generating urls of links posted in it. As far as code tags are concerned I can't even see [only_members] tags working properly in it, and it has been explained above by arantor also,

Quote from: Arantor on March 20, 2011, 02:37:16 PM
No, because the code tag rewrites everything in it except for the closing tag. (Much as the nobbc and html tags would do)

That's not avoidable without rewriting the entire parser, just put the code tags inside the members only tag.
Title: Re: Member Only BBC
Post by: TASSADAR on March 21, 2011, 01:35:21 PM
Still don't work with me, this is what i've done with this mod (i renamed the tag from only_members to hide and added the tag button) :

/Themes/default/Post.template.php

/* Hide */
'hide' => array('code' => 'hide', 'before' => '[hide]', 'after' => '[/hide]', 'description' => $txt['hide_posting']),
/* END Hide */


Themes/default/languages/Modifications.french.php

$txt['hide_posting'] = 'Cacher le contenu';

Sources\Subs.php


array(
                'tag' => 'hide',
                'type' => 'unparsed_content',
                'content' => $context['user']['is_logged'] ? '$1' :'<center><b>[ Merci de vous <a href="http://www.tassadar-forum.net/index.php?action=login">connecter</a> ou <a href="http://www.tassadar-forum.net/index.php?action=register">vous inscrire</a> sur le forum pour voir le contenu cach&eacute; !! ]</b></center>',
'validate' => create_function('&$tag, &$data, $disabled', '
if (isset($disabled[\'url\']))
$tag[\'content\'] = \'$1\';
elseif (strpos($data[0], \'http://\') !== 0 && strpos($data[0], \'https://\') !== 0)
$data[0] = \'http://\' . $data[0];
'),
            ),


Everything works fine, exept bbcode don't work inside it.

I've the following mod installed with SMF 1.1.13 (only french language) and using custom theme wich use most of default theme files:
- Ad Managment
- YouTube BBC Tag (XHTML Compliant)
- Googlebot & Spiders Mod
- FlashChat Integration

Thanks in advance for your help.
Title: Re: Member Only BBC
Post by: Joker™ on March 22, 2011, 05:52:02 AM
Amazing yesterday with the code I've posted above when I tested  this tag it worked fine on my PC, and now it doesn't seem to work at all on notebook. Will see whats the problem with the code again, but first would like to test it on PC.
Title: Re: Member Only BBC
Post by: Arantor on January 26, 2014, 04:48:24 PM
Moved to the BBC category of mods.