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.
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 !? :'(
Very good, thanks
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 !
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',
),
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 !
Please, can anyone help for my first question !? :'(
No one can help !? :(
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.
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.
[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.
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.
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.... :-\
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
Ok, so there is no solution to solve this issue !? or make it compatible with 1.1.13 !? :-\
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.
Ok, thanks a lot for your help, hope someone else can help us.
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.
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é !! ]</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.
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.
Moved to the BBC category of mods.