Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=2861)
This mod gives the possibility to hide or show the content of BBC tags to guests.
Going to:
admin > forum > posts and topics > Bulletin Board Code it is possible to select which BBC tags show (or hide) to guests.
If a tag is set to be kept hidden to guests then a warning suggesting to login or register is prompted instead of the content of the tag.
Change log
- 0.1.7: fixed undefined error due to the change of revision 0.1.6
- 0.1.6: now keeps the formatting of the used tag (with few exceptions like url) and hides only the content
- 0.1.5: updated compatibility
- 0.1.4: if bbcodes were added with hooks after this modification was installed weren't listed in the bbcode page as expected
- 0.1.3:
- replaced the change to Subs.php with the integrate_bbc_codes (http://wiki.simplemachines.org/smf/Integration_hooks#integrate_bbc_codes) hook
- updated to SMF 2.0
- 0.1.2: updated to SMF 2.0 RC5
- 0.1.1: initial release
i have install this mod but it's not working, where can i found that hide tag setting ??
Sorry for the late reply...
In the same page where you can enable BBCode tags: admin -> forum -> posts and topics -> Bulletin Board Code
At the end of the page you can find a table with the list of all the BBCodes available and you deselect those you don't want to show to guests...anyway you are right: I should have written some instructions... :-[
not work any way : (
Guests can still see the content of bbcodes?
Or you don't see any option in the admin page?
i get error in rc5:
Find[Select]
foreach ($codes as $code) { // If we are not doing every tag only do ones we are interested in. if (empty($parse_tags) || in_array($code['tag'], $parse_tags)) $bbc_codes[substr($code['tag'], 0, 1)][] = $code;
Replace[Select]
if(isset($modSettings['hiddenBBC'])) $hiddenBBC = explode(',', $modSettings['hiddenBBC']); foreach ($codes as $code) { if(isset($hiddenBBC) && in_array($code['tag'], $hiddenBBC) && $user_info['is_guest']){ $code['type'] = isset($code['type']) ? $code['type'] : 'unparsed_content'; switch ($code['type']){ case 'unparsed_equals': case 'unparsed_equals_content': case 'parsed_equals': $code['type'] = 'unparsed_equals_content'; break; case 'unparsed_content': case 'closed': $code['type'] = $code['type']; break; case 'unparsed_commas': case 'unparsed_commas_content': $code['type'] = 'unparsed_commas_content'; break; } $code['content'] = '<div style="display:block">' . $txt['mod_not_allowed_see'] . ' ' . $txt['login_or_register'] . '</div>'; unset($code['test']); unset($code['disabled_content']); unset($code['disabled_before']); unset($code['disabled_after']); unset($code['block_level']); unset($code['trim']); unset($code['validate']); unset($code['quoted']); unset($code['require_parents']); unset($code['require_children']); unset($code['disallow_children']); unset($code['parsed_tags_allowed']); } // If we are not doing every tag only do ones we are interested in. if (empty($parse_tags) || in_array($code['tag'], $parse_tags)) $bbc_codes[substr($code['tag'], 0, 1)][] = $code;
in subs.php
It works fine in a fresh install, probably you have some other mod installed that changes this part of the file.
I've uploaded a new version that doesn't require this edit. ;)
Thanks.... :)
Can I Do this like??
Open the file Subs-ShowBBCodeToGuests.php (in Sources), then search for:
$code['content'] = '<div style="display:block">' . $txt['mod_not_allowed_see'] . ' ' . $txt['login_or_register'] . '</div>';[/quote]
Here you can define the style of the "warning".
For example to show it like a quote you can change it to:
[code] $code['content'] = '<blockquote class="bbc_standard_quote">' . $txt['mod_not_allowed_see'] . ' ' . $txt['login_or_register'] . '</blockquote>';[/quote]
That could be a feature for the next version! ;)
thanks... :) can i remove quotes " sign from left side?
Oh yes, I see.
Maybe try this instead:
$code['content'] = '<code class="bbc_code">' . $txt['mod_not_allowed_see'] . ' ' . $txt['login_or_register'] . '</code>';[/quote]
it works fine - but there are 2 messages in the error log:
http://aida32-inventory.netboom.de/smf/index.php?topic=62.msg2238: Undefined index: login_or_register
Datei: /home/syscp/webs/<private>/smf/Sources/Subs-ShowBBCodeToGuests.php
line: 29
http://aida32-inventory.netboom.de/smf/index.php?topic=62.msg2238: Undefined index: mod_not_allowed_see
Datei: /home/syscp/webs/<private>/smf/Sources/Subs-ShowBBCodeToGuests.php
line: 29
I've put these strings in Modifications-german-utf8.php
$txt['mod_not_allowed_see'] = 'Sorry, es ist Dir nicht erlaubt den Inhalt zu sehen.';
$txt['login_or_register'] = 'Registriere Dich oder melde Dich an.';
What's wrong - line 29 refers to 'mod_not_allowed_see' and 'login_or_register'
Any idea?
cheers Inti31
Both are rather strange errors for SMF 2.0...
But login_or_register it's *very* strange since this is an SMF text string and it isn't introduced by the mod...
I think you have some other problems with languages. Please check if you get the same error with English too.
And just to be sure it's only a typo: it should be Modifications.german-utf8.php ;)
Quote from: emanuele on August 29, 2011, 09:32:08 AM
Both are rather strange errors for SMF 2.0...
But login_or_register it's *very* strange since this is an SMF text string and it isn't introduced by the mod...
it isn't?
Line 29 of
Subs-ShowBBCodeToGuests.php shows:
$code['content'] = '<div style="display:block">' . $txt['mod_not_allowed_see'] . ' ' . $txt['login_or_register'] . '</div>';
and because I didn't find both strings I put them into Modifications.german-utf8.php...
Addition:
okay:
$txt['login_or_register'] is located in index.german-utf8.php.
I removed now that string from Modifications.german.utf8.php; am going to see if that was the mistake...
thx Inti31
Quote from: Inti31 on August 29, 2011, 10:51:38 AM
it isn't?
As you already noticed login_or_register is not introduced by the mod (probably bad wording from my side, maybe "it is borrowed from SMF language strings" was a better way to say it), it's only used by the mod. ;)
That's way I said it's very strange you get an undefined index error with a "native" SMF string.
¿Se podría modificar el código para que en vez en ocultar todo el BBC, solamente se oculte el contenido el bbc?
Could you modify the code so that instead to hide all the BBC, only the bbc hide content?
Sample:
(http://s2.subirimagenes.com/imagen/previo/thump_7173272sin-ttulo.png)
In Subs-ShowBBCodeToGuests.php, you can change the line:
$code['content'] = '<div class="sbtog_hideblock" style="display:block">' . $txt['mod_not_allowed_see'] . ' ' . $txt['login_or_register'] . '</div>';
adding all the formatting you want. ;)
Thanks, but I do not think I explained well. What I want is to not hide all the bbc, only the content, so that each retains your style.
(http://img338.imageshack.us/img338/7563/sinttulo2tf.png)
Not hide "before" and "after"
array(
'tag' => 'black',
'before' => '<span style="color: black;" class="bbc_color">',
'after' => '</span>',
),
I understood what you wanted, but since you presented a very specific example (and we all know what it is for) I didn't consider worth the work needed. :P
Now Looking from another perspective I can see the advantage.
Updated the mod, maybe there are still few glitches with few tags, it needs a bit of testing.
Ok, thanks for your attention.
Preserving the style, visitors will know what he is hiding y have a reason to register.
Depends on the visitor. :P
/me wonders why he did this mod in the first place... ???
Ouuu!!!! Thanks for the 0.1.6 versión emanuele!
hello sir
At first it is only one mod which is compatible with SMF2.0.1 regarding BBC codes. In its newest release it allowed to stop/ hide any particular BBC code to guest.
Now i have little improvement. when we decide to hide BBC from guest we put our scrip/code for guest member group. Then shall we add such setting that we can change this guest member group to other member (say Jr. Member)? In this way we can set particular BBC code stetting for each group.
I am asking for this help because i want to hide some VIP content from normal user. IT is allowed to view to only paid members.
what you say?
The way the mod works now it would be useless. A quote would be enough to reveal the hidden text.
If you want to have "VIP" content the best way would be to set up a board only for a certain membergroup. ;)
Hi emanuele,
Really nice you mod, it´s basic in my community but I don´t understand why it´s generating a lot of errors in error log. I think every time a visitor view a post with a hidden htl (the bbc code i´m hiding) generates this error:
http://www.xxxxxxxxxx.es/index.php?dummy=1&topic=1689.msg4654
8: Array to string conversion
Archivo: /xxx/xxxxxx/xxxxxxx/www/Sources/Subs.php(1611) : runtime-created function
Líne: 1
The installation was correct, the language strings are correct in modifications-utf8.... Only stop the error when I let the guests to see all bbc codes or when I uninstall the mod.
Please I need your help.
Best regards.
Than.
Hi than,
I wonder why I wrote it... :P
May I ask you to attach here your Subs.php?
Ok, I attached it.
Thank´s ;)
At line 1611 there is the url tag, and I can't find any "htl" tag, so which tag are you hiding?
url, sorry i´m referring to url not html ::)
Fixed (I hope).
Wat I should to do?
A new version of the mod is uploaded to the mod site, install that :)
Impresed with your support. Installed the new version, and working perfect.
Really nice joob guys :laugh:
Best regards. ;)
This mod not working for youtube bbcode? :/
Which one?
http://custom.simplemachines.org/mods/index.php?mod=2861
I know that...I mean which youtube bbcode.
http://custom.simplemachines.org/mods/index.php?mod=936
Okay, got it.
In Subs-ShowBBCodeToGuests.php:
if (isset($code['validate']) && !in_array($code['tag'], $no_beforeafter_tags))
$code['validate'] = create_function('&$tag, &$data, $disabled', '
$data = \'' . $warning_text . '\';
');
if (isset($code['validate']) && !in_array($code['tag'], $no_beforeafter_tags))
{
$code['validate'] = create_function('&$tag, &$data, $disabled', '
$data = \'' . $warning_text . '\';
');
if (!isset($code['content']))
$code['content'] = '$1';
}
Dear emanuele,
maybe a silly question. I am not sure. Does the mod work on 2.0.4 as well? Thanks for your replay!
The question goes to others as well if they could help me out.
Thanks a lot!
(http://sangham.net/Smileys/sadhu_sangham.gif)
Yep, it works.
Quote from: emanuele on March 02, 2013, 09:01:17 AM
Yep, it works.
Thanks a lot for your answer!
(http://sangham.net/Smileys/sadhu_sangham.gif)
Hello together,
I 've been using for 1year the cb | GeSHi -mod. Now I have also installed the "Show BBCode content to guests"-modification. http://custom.simplemachines.org/mods/index.php?mod=2861
I think it is a very useful modification , thank you for that.
It works for images with no problems. Instead picture the warning message appears .
For code, it only works if I use the normal code container by SMF. Then a code container appears , in which instead code the warning message is displayed.
Do I use the cb | GeSHi -mod the code container is apparently not recognized as such. And there where the code should be container only appears a <
I suspect that is because the SMF code container is opened with [code] and of cb | GeSHi -mod with [code = language ]
Is there any way to use both together ?
I would appreciate the help very much.
Many thanks and best regards
moal
Sorry, incidentally, I do not speak English and therefore use the Google translator.
For the way the GeSHi mod is coded, it's not possible to have something really nice without an "exception", but I don't like exceptions and unfortunately at the moment I'm a bit short of time, so I can't have a look at it.
The fastest way is to replace:
$code['validate'] = create_function('&$tag, &$data, $disabled', '
$data = \'' . $warning_text . '\';
');
with:
$code['validate'] = create_function('&$tag, &$data, $disabled', '
if (is_array($data))
$data[0] =\'' . $warning_text . '\';
else
$data = \'' . $warning_text . '\';
');
in Subs-ShowBBCodeToGuests.php.
It's not nice, but it works.
Danke, das hilft mir weiter... :laugh:
Hello,
First of all great mod no problem with it's functioning but is there anyway by which it can show an image instead of text that "sorry guest ..... Please Login or register"
thanks, :)