News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Member Only BBC

Started by ɔɔɔɔɔɔuɥoɾ, August 20, 2010, 02:55:28 AM

Previous topic - Next topic

ɔɔɔɔɔɔuɥoɾ

Link to Mod

This mod will allow you to easily hide any content in posts from guests using a bbc tag.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

TASSADAR

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 !?  :'(

impreza

Portal ToTemat.pl - Filmy i Artykuły

Perspective

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 !

TASSADAR

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',
            ),

Perspective

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 !

TASSADAR

Please, can anyone help for my first question !?  :'(

TASSADAR


Joker™

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.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

TASSADAR

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.

Joker™

[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.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Arantor

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.
Holder of controversial views, all of which my own.


TASSADAR

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....  :-\

Joker™

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
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

TASSADAR

Ok, so there is no solution to solve this issue !? or make it compatible with 1.1.13 !?  :-\

Joker™

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.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

TASSADAR

Ok, thanks a lot for your help, hope someone else can help us.

Joker™

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.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

TASSADAR

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.

Joker™

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.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Advertisement: