Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Now Available => Topic started by: Kirby on November 28, 2004, 12:40:58 PM

Title: SMF [hide] BBCode
Post by: Kirby on November 28, 2004, 12:40:58 PM
Notice:
This tip has been in some way ported over to be a modification package located on the SMF modsite. Please note, the mod package may not do the exact same function and may not even use any of the code originally written for the tip, but should still hold the same basic functionality of the tip posted here. With the mod package for this tip, you can now let the SMF package manager make the code changes for you without you having to look at the code and edit it manually.

For documentation on using the SMF package manager, view this document (http://docs.simplemachines.org/index.php?board=49.0).

http://mods.simplemachines.org/index.php?mod=118
http://mods.simplemachines.org/index.php?mod=228




This is a "port" of Big P's [hide] mod from YaBB SE. Text inside the hide tag is not displayed to guests or users who have not replied to the topic. Admins are immune; they can see it no matter what :P

Open: Subs.php

Look for:
global $modSettings, $scripturl, $txt, $settings, $context;

Add after:
global $ID_MEMBER, $db_prefix, $user_info;

Look for:
// Moving text... [move]stuff[/move]

Add before:

// [hide]Guests cannot see this! Mwahaha![/hide]
$codefromcache[] = '~\[hide\](.+?)\[/hide\]~i';
if (isset($disabled['hide']) || $user_info['is_admin'])
    $codetocache[] = '$1';
    else
    {
if (!empty($context['current_topic']) && !$user_info['is_guest'])
{
$request = mysql_query("
SELECT ID_MSG FROM {$db_prefix}messages
WHERE ID_MEMBER = $ID_MEMBER
AND ID_TOPIC = $context[current_topic]
LIMIT 1");

if (mysql_num_rows($request))
$codetocache[] = '<b>$1</b>';
else
$codetocache[] = $txt['hide_tag_a'];
mysql_free_result($request);
    }
    else
    $codetocache[] = $txt['hide_tag_b'];
      }


Open: Themes/default/languages/Modifications.english.php  (or whatever your modifications language file is)

Look for:
?>

Add before:

$txt['hide_tag_a'] = '<i>This message is hidden from users who have not posted in this topic. To get rid of this and see the actual message, you must reply to the topic.</i>';
$txt['hide_tag_b'] = '<i>This message is hidden from guests. To get rid of this and see the actual message, you must register or login, and then reply to the topic.</i>';


Enjoy :D

Coming soon for this mod:
optional BBC button
.mod format/package server
Title: Re: SMF [hide] BBCode
Post by: ANARCH¥ on November 28, 2004, 04:08:42 PM
i have to say thx for all of us.

Edt: not working for me...
i placed the txt inside hide tag but text is readable by all... it look like
[hide]mytextinhidetaghere[/hide]

hmmm...dont know what to do
Title: Re: SMF [hide] BBCode
Post by: Kirby on November 28, 2004, 05:02:30 PM
It can be readable by admins no matter what...
Title: Re: SMF [hide] BBCode
Post by: ANARCH¥ on November 28, 2004, 05:13:11 PM
well. i tested with 2 basic account:
created post with test1 and log after with test 2 ...
test 2 see all text more the hide tag...

ah, i surely missed something ... but what ?

do i have to say the first line change is after:
global $modSettings, $scripturl, $txt, $settings, $context;
but my subs.php have only that:
global $modSettings, $scripturl, $txt;

so, i added $settings, $context;   was wrong?
Title: Re: SMF [hide] BBCode
Post by: A.M.A on November 28, 2004, 05:17:51 PM
If you can see [hide]mytextinhidetaghere[/hide] that's mean the parser is not working .. please double check that you have done the exact steps.
Title: Re: SMF [hide] BBCode
Post by: Kirby on November 28, 2004, 06:40:34 PM
What version of SMF are you using?
Title: Re: SMF [hide] BBCode
Post by: ANARCH¥ on November 29, 2004, 07:01:28 AM
well, rc1 upgraded to rc2
Title: Re: SMF [hide] BBCode
Post by: edi67 on November 29, 2004, 09:26:12 AM
work perfectly for me
Title: Re: SMF [hide] BBCode
Post by: ANARCH¥ on November 29, 2004, 01:24:27 PM
can i uninstall parser mod and reinstall it ?
Title: Re: SMF [hide] BBCode
Post by: Kirby on November 29, 2004, 07:11:11 PM
Oh; no wonder. Then just add the line after the one you found.
Title: Re: SMF [hide] BBCode
Post by: ANARCH¥ on December 02, 2004, 09:21:04 PM
i had to desinstall fastparser code and now its working good...thx.
Title: Re: SMF [hide] BBCode
Post by: allfripou on December 03, 2004, 03:24:26 PM
works very well

I have made a small mod package for RC2 out of it if anyone is interested
Title: Re: SMF [hide] BBCode
Post by: Kirby on December 03, 2004, 07:56:30 PM
glad to hear its working :P
ill be releasing a .mod/package manager version soon too...
Title: Re: SMF [hide] BBCode
Post by: edi67 on December 04, 2004, 08:41:57 AM
i waiting your bbc button and correction about QUOTE

thx kirby best work
Title: Re: SMF [hide] BBCode
Post by: src on December 30, 2004, 09:53:01 AM
doesn't work fer me :(

I got:
Parse error: parse error, unexpected T_STRING, expecting ')' in /home/srecka/public_html/forums/Sources/Subs.php on line 1882
Title: Re: SMF [hide] BBCode
Post by: ThaiAnime on January 01, 2005, 01:29:51 AM
Oh! Thank you.
Title: Re: SMF [hide] BBCode
Post by: FaSan on January 02, 2005, 05:55:48 AM
I have need that the message within the code [hide] is not quotable...

where it is the code of the quotas ?




FaSan
Title: Re: SMF [hide] BBCode
Post by: XanTrax on January 19, 2005, 06:42:45 PM
doesnt work....all i got is the [hide]textishere[/hide]

also viewed as a guest and a normal member and its the same  ::)


used on SMF 1.1..........
Title: Re: SMF [hide] BBCode
Post by: XanTrax on January 19, 2005, 06:48:38 PM
nevermind it works :D
Title: Re: SMF [hide] BBCode
Post by: FaSan on January 29, 2005, 01:05:00 PM
For not quotable code ... open Post.php:


<search>
// Add a quote string on the front and end.
</search>

<add before>
$form_message = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), '', $form_message);
</add before>



;)


FaSan
Title: Re: SMF [hide] BBCode
Post by: FaSan on January 31, 2005, 12:04:38 PM
For quote from quick reply, change this (in Post.php) :



<search>
// Add a quote string on the fron and end.
</search>

<add before>
$row['body'] = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), '', $row['body']);
</add before>





FaSan ;)
Title: Re: SMF [hide] BBCode
Post by: [darksteel] on February 18, 2005, 10:17:52 AM
is possible add or show other imagen in Message Index ( icon )

Title: Re: SMF [hide] BBCode
Post by: Kirby on February 18, 2005, 09:38:09 PM
You mean a button for it?
Title: Re: SMF [hide] BBCode
Post by: [darksteel] on February 19, 2005, 10:03:02 AM
no, one imagen like (http://www.simplemachines.org/community/Themes/simple/images/topic/normal_post.gif) Different.

Separating normal post .VS. Post whit HIDE bbc code.
Title: Re: SMF [hide] BBCode
Post by: Kirby on February 22, 2005, 10:37:38 PM
ah... i think i understand what your saying
shouldnt be TOO hard to do, but I'd rather make the image a user-choosable icon
Title: Re: SMF [hide] BBCode
Post by: readme.txt on February 25, 2005, 05:24:01 AM
Quote from: edi67 on December 04, 2004, 08:41:57 AM
i waiting your bbc button and correction about QUOTE

thx kirby best work

Me too, thanks Kirby...


Title: Re: SMF [hide] BBCode
Post by: readme.txt on February 26, 2005, 01:35:52 PM
hi, have problem:

8: Undefined variable: disabled
file: /home/#####/public_html/forum/Sources/Subs.php
line: 973


Line 971: // [hide]Guests cannot see this! Mwahaha![/hide]
Line 972: $codefromcache[] = '~\[hide\](.+?)\[/hide\]~i';
Line 973: if ($disabled['hide'] || $user_info['is_admin'])
Line 974:     $codetocache[] = '$1';



some solution?
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on February 26, 2005, 11:55:13 PM
Quote from: FaSan on January 31, 2005, 12:04:38 PM
For quote from quick reply, change this (in Post.php) :



<search>
// Add a quote string on the fron and end.
</search>

<add before>
$row['body'] = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), '', $row['body']);
</add before>





FaSan ;)

This code does not work for quick reply.
Title: Re: SMF [hide] BBCode
Post by: Kirby on February 26, 2005, 11:57:52 PM
change $disabled['hide'] to isset($disabled['hide'])
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on February 27, 2005, 12:18:19 AM
Quote from: Kirby on February 26, 2005, 11:57:52 PM
change $disabled['hide'] to isset($disabled['hide'])

My bad, Fasan didn't mention that there was a duplicate of this line near the end of the Post.php
// Add a quote string on the fron and end.

Everything works like a charm now, great mod!
Title: Re: SMF [hide] BBCode
Post by: FaSan on February 27, 2005, 09:31:33 AM
See the spaces before ;)
Title: Re: SMF [hide] BBCode
Post by: readme.txt on February 27, 2005, 04:26:25 PM
Quote from: Kirby on February 26, 2005, 11:57:52 PM
change $disabled['hide'] to isset($disabled['hide'])

Thanks Kirby
Title: Re: SMF [hide] BBCode
Post by: Kirby on February 28, 2005, 12:20:43 AM
no problemo ;)
Title: Re: SMF [hide] BBCode
Post by: Xtasy on March 07, 2005, 01:34:38 AM
hey guys, terrific mod! However, even as guest im still able to view the code [hide]TEST[/hide], any ideas of why this may be? Im using smf 1.0.2. I assume it has sumthin with the parsing not working, but ive checked my steps 5 times.

My Boards: www.xenez.com
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on March 07, 2005, 11:49:39 PM
Quote from: Xtasy on March 07, 2005, 01:34:38 AM
hey guys, terrific mod! However, even as guest im still able to view the code [hide]TEST[/hide], any ideas of why this may be? Im using smf 1.0.2. I assume it has sumthin with the parsing not working, but ive checked my steps 5 times.

My Boards: www.xenez.com

that shouldn't be the case, guest can't see anything but the message on my board, and I'm running 1.0.2.

You want to sextuple check your code.
Title: Re: SMF [hide] BBCode
Post by: Nyx on March 17, 2005, 10:39:05 PM
Quote from: anibal on February 26, 2005, 01:35:52 PM
hi, have problem:

8: Undefined variable: disabled
file: /home/#####/public_html/forum/Sources/Subs.php
line: 973


Line 971: // [hide]Guests cannot see this! Mwahaha![/hide]
Line 972: $codefromcache[] = '~\[hide\](.+?)\[/hide\]~i';
Line 973: if ($disabled['hide'] || $user_info['is_admin'])
Line 974:     $codetocache[] = '$1';



some solution?

I have this same problems

Quote from: Kirby on February 26, 2005, 11:57:52 PM
change $disabled['hide'] to isset($disabled['hide'])

This does not work :( please help
Title: Re: SMF [hide] BBCode
Post by: Sys_ZERO on March 25, 2005, 01:33:36 AM
There's a problem with mine aswell  :-\

It just shows as blank .. No words ..

So if I went : [hide] TEXT [/hide]

it shows as:



What is the problem of this ?

thanks
Title: Re: SMF [hide] BBCode
Post by: ディン1031 on April 29, 2005, 07:50:31 AM
Huuu i never saw this thread... (how can i oversee thatthread)

Somehow i made a [hide][/hide] mod (Without knowing about this thread).

http://mods.simplemachines.org/index.php?mod=118

I hope i'm allowed to make this advertising. :)
Title: Re: SMF [hide] BBCode
Post by: Neol on May 07, 2005, 11:18:52 AM
It works  ;)

But can Google & Co see this hiden messages?
Title: Re: SMF [hide] BBCode
Post by: Kirby on May 07, 2005, 01:27:04 PM
Quote from: olti on May 07, 2005, 11:18:52 AM
It works  ;)

But can Google & Co see this hiden messages?
Only if they can magically log in ;D
Title: Re: SMF [hide] BBCode
Post by: pilsentico on June 02, 2005, 01:07:14 PM
what shoul i do i want this mod only works for guest only. They can't see the post but members yes?
Links for registered members only
Thanks!
Title: Re: SMF [hide] BBCode
Post by: cinestar on June 25, 2005, 12:50:30 PM
I am looking for something similar.
I would like to have the same functionality except I dont want the users to have to reply, in order to see the content. Instead, the content should be automatically hidden from users who have not yet posted x amount of posts.

This would allow me to provide special rewards to my members who actually participate in discussions etc. But not promote just posting for the sake of viewing or accessing the material.

The tag could look like

[hide=22]Special goodie here for anyone with twenty to posts or more[/hide]

or

[hide=50]You've posted 50 or more posts, you deserve to access this bit...[/hide]
Title: Re: SMF [hide] BBCode
Post by: [Unknown] on June 25, 2005, 11:33:48 PM
Quote from: Elijah Bliss on June 25, 2005, 11:30:45 PM
Is an Beta 3 update possible?

Beta 3 is a lot easier.  If you can tell me:
  - what parameters, if any, it takes and how they effect things.
  - what code should be used before the content of the tag, and after the content.
  - whether the content should be parsed by other tags.

For any tag, I can tell you how to add it.  It's much easier than in 1.0.

-[Unknown]
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on June 25, 2005, 11:40:48 PM
Quote from: [Unknown] on June 25, 2005, 11:33:48 PM
Quote from: Elijah Bliss on June 25, 2005, 11:30:45 PM
Is an Beta 3 update possible?

Beta 3 is a lot easier.  If you can tell me:
  - what parameters, if any, it takes and how they effect things.
  - what code should be used before the content of the tag, and after the content.
  - whether the content should be parsed by other tags.

For any tag, I can tell you how to add it.  It's much easier than in 1.0.

-[Unknown]

Well here's the original code...
http://www.simplemachines.org/community/index.php?topic=20652.msg165353#msg165353

I was poking around at it, but this block:
// [hide]Guests cannot see this! Mwahaha![/hide]
$codefromcache[] = '~\[hide\](.+?)\[/hide\]~i';
if ($disabled['hide'] || $user_info['is_admin'])
   $codetocache[] = '$1';
   else
   {
if (!empty($context['current_topic']) && !$user_info['is_guest'])
{
$request = mysql_query("
SELECT ID_MSG FROM {$db_prefix}messages
WHERE ID_MEMBER = $ID_MEMBER
AND ID_TOPIC = $context[current_topic]
LIMIT 1");

if (mysql_num_rows($request))
$codetocache[] = '<b>$1</b>';
else
$codetocache[] = $txt['hide_tag_a'];
mysql_free_result($request);
   }
   else
   $codetocache[] = $txt['hide_tag_b'];
     }


has me a bit stumped, I no longer see the "$codefromcache[] and $codetocache[]" variables.
Title: Re: SMF [hide] BBCode
Post by: [Unknown] on June 26, 2005, 12:25:07 AM
Essentially, you put this:

if (!empty($context['current_topic']) && !$context['user']['is_guest'])
{
$request = db_query("
SELECT ID_MSG
FROM {$db_prefix}messages
WHERE ID_MEMBER = $ID_MEMBER
AND ID_TOPIC = $context[current_topic]
LIMIT 1");

if (mysql_num_rows($request))
$hide_text = false;
else
$hide_text = $txt['hide_tag_a'];
mysql_free_result($request);
    }
    else
$hide_text = $txt['hide_tag_b'];

$cache_id = '';


Above this:

// Shall we take the time to cache this?

Use this for the tag:

array(
'tag' => 'hide',
'validate' => '
if ($hide_text !== false)
$data = $hide_text;'
'before' => '<b>',
'after' => '</b>',
),


-[Unknown]
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on June 26, 2005, 01:02:30 AM
Can't get it to hide. The hidden DIVs don't render to hide the content, just the bold tags.
Title: Re: SMF [hide] BBCode
Post by: [Unknown] on June 26, 2005, 01:20:05 AM
Actually, that won't work exactly as described.  It would require a few more modifications, unfortunately.

-[Unknown]
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on June 26, 2005, 01:54:07 AM
Quote from: [Unknown] on June 26, 2005, 01:20:05 AM
Actually, that won't work exactly as described.  It would require a few more modifications, unfortunately.

-[Unknown]

oh, ok, but thanks for putting us on the right track.
Title: Re: SMF [hide] BBCode
Post by: diane_tt on July 08, 2005, 06:21:31 PM
wow this works great. thank you very very much. now to find out how to use an image  ;D
Title: Re: SMF [hide] BBCode
Post by: diane_tt on July 08, 2005, 06:35:42 PM
Quote from: FaSan on January 31, 2005, 12:04:38 PM
For quote from quick reply, change this (in Post.php) :



<search>
// Add a quote string on the fron and end.
</search>

<add before>
$row['body'] = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), '', $row['body']);
</add before>





FaSan ;)

i'm sorry i'm really new at this...where do i add this in post? and i did not do it correct it still shows so i go back to original post i had. thank you.
Title: Re: SMF [hide] BBCode
Post by: Metal_GunBlade on July 22, 2005, 01:25:55 PM
When will this mod support SMF 1.1 Beta 3 Public???
Title: Re: SMF [hide] BBCode
Post by: Kirby on July 25, 2005, 07:24:21 PM
SMF 1.1 Beta 3 Public uses a completely different BBcode parsing engine. I have very limited time so I can't say I can work on it now (to be honest I haven't worked much with the new engine) :(
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on July 25, 2005, 11:07:01 PM
Quote from: ??? on July 25, 2005, 07:24:21 PM
SMF 1.1 Beta 3 Public uses a completely different BBcode parsing engine. I have very limited time so I can't say I can work on it now (to be honest I haven't worked much with the new engine) :(

I took a stab at it but couldn't get it to work.
Title: Re: SMF [hide] BBCode
Post by: abdelyou on August 08, 2005, 05:00:43 PM
doesn't work for 1.1 beta
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on August 08, 2005, 08:35:49 PM
Quote from: abdelyou on August 08, 2005, 05:00:43 PM
doesn't work for 1.1 beta

I wish I had time to tinker with this, or get some help on it, I really liked this mod, but I can't get it to work with the new BBC engine, it's probably something simple I am missing.
Title: Re: SMF [hide] BBCode
Post by: abdelyou on September 03, 2005, 07:06:40 AM
ok thinks for ur help
but how can i change the new parser engine by the old one if it's possible...
and thinks twice ;D
Title: Re: SMF [hide] BBCode
Post by: diane_tt on September 05, 2005, 10:17:22 PM
waaah this is the best!! thank you so much kirby and fasan! oooh i have one question? is there a way to add [hide] as a button? i know there's a hide mod that i could install that would do it but i'm afraid it would change the current image that i have on it.  :(
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on September 25, 2005, 04:53:44 AM
I have this working in 1.1 Beta 3:

Find
$codes = array(

add after

array(
'tag' => 'hide',
'type' => 'unparsed_content',
'content' => '<b>$1</b>',
'validate' => 'if ($hide_text !== false)
$data = $hide_text;',                             
),


Find
// Shall we take the time to cache this?

add before

// [hide]Guests cannot see this! Mwahaha![/hide]
global $ID_MEMBER, $db_prefix, $user_info;


if (!empty($context['current_topic']) && !$user_info['is_guest'])
{
$request = mysql_query("
SELECT ID_MSG FROM {$db_prefix}messages
WHERE ID_MEMBER = $ID_MEMBER
AND ID_TOPIC = $context[current_topic]
LIMIT 1");

if (mysql_num_rows($request))
$hide_text = false;
else
$hide_text = $txt['hide_tag_a'];
mysql_free_result($request);
}
else
$hide_text = $txt['hide_tag_b'];

$cache_id = '';
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on September 25, 2005, 05:51:07 AM
For SMF 1.1 RC 1 only

Find in Sources/Subs.php
                $codes = array(

add after

array(
'tag' => 'hide',
'type' => 'unparsed_content',
'content' => '<b>$1</b>',
'validate' => create_function('&$tag, &$data, $disabled', '
global $context, $ID_MEMBER, $db_prefix, $user_info, $txt;
if (!empty($context[\'current_topic\']) && !$user_info[\'is_guest\'])
{
$request = mysql_query("
SELECT ID_MSG FROM {$db_prefix}messages
WHERE ID_MEMBER = $ID_MEMBER
AND ID_TOPIC = $context[current_topic]
LIMIT 1");

if (mysql_num_rows($request))
$data;
else
$data = $txt[\'hide_tag_a\'];
mysql_free_result($request);
}
elseif ($user_info[\'is_guest\'])
{
$data = $txt[\'hide_tag_b\'];
}

$cache_id = "";
'),
),


Don't forget to apply Fasan's mods as well:
http://www.simplemachines.org/community/index.php?topic=20652.msg204774#msg204774
http://www.simplemachines.org/community/index.php?topic=20652.msg205896#msg205896

Big Ups!
Title: Re: SMF [hide] BBCode
Post by: Snickers on September 26, 2005, 11:07:45 AM
Don't forget modifications.template.php  :P

Open: Themes/default/languages/Modifications.english.php  (or whatever your modifications language file is)

Look for:
?>


Add before:
$txt['hide_tag_a'] = '<i>This message is hidden from users who have not posted in this topic. To get rid of this and see the actual message, you must reply to the topic.</i>';
$txt['hide_tag_b'] = '<i>This message is hidden from guests. To get rid of this and see the actual message, you must register or login, and then reply to the topic.</i>';


;D
Title: Re: SMF [hide] BBCode
Post by: Snickers on September 26, 2005, 11:38:45 AM
Quote from: Elijah Bliss on September 25, 2005, 05:51:07 AM
For SMF 1.1 RC 1 only

Find in Sources/Subs.php
                $codes = array(

add after

array(
'tag' => 'hide',
'type' => 'unparsed_content',
'content' => '<b>$1</b>',
'validate' => create_function('&$tag, &$data, $disabled', '
global $context, $ID_MEMBER, $db_prefix, $user_info, $txt;
if (!empty($context[\'current_topic\']) && !$user_info[\'is_guest\'])
{
$request = mysql_query("
SELECT ID_MSG FROM {$db_prefix}messages
WHERE ID_MEMBER = $ID_MEMBER
AND ID_TOPIC = $context[current_topic]
LIMIT 1");

if (mysql_num_rows($request))
$data;
else
$data = $txt[\'hide_tag_a\'];
mysql_free_result($request);
}
elseif ($user_info[\'is_guest\'])
{
$data = $txt[\'hide_tag_b\'];
}

$cache_id = "";
'),
),


this part of the code:
if (mysql_num_rows($request))
$data;


Data is the actual stuff behind[hide] right?
So can you edit it so it says something like:
if (mysql_num_rows($request))
[color=red]Hidden Text:[/color] '.$data.';


Is that possible?
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on September 26, 2005, 02:18:31 PM
Quote from: Snickers on September 26, 2005, 11:07:45 AM
Don't forget modifications.template.php  :P

Open: Themes/default/languages/Modifications.english.php  (or whatever your modifications language file is)

Look for:
?>


Add before:
$txt['hide_tag_a'] = '<i>This message is hidden from users who have not posted in this topic. To get rid of this and see the actual message, you must reply to the topic.</i>';
$txt['hide_tag_b'] = '<i>This message is hidden from guests. To get rid of this and see the actual message, you must register or login, and then reply to the topic.</i>';


;D

I thought that went without saying.
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on September 26, 2005, 02:22:22 PM
Quote from: Snickers on September 26, 2005, 11:38:45 AM
Quote from: Elijah Bliss on September 25, 2005, 05:51:07 AM
For SMF 1.1 RC 1 only

Find in Sources/Subs.php
                $codes = array(

add after

array(
'tag' => 'hide',
'type' => 'unparsed_content',
'content' => '<b>$1</b>',
'validate' => create_function('&$tag, &$data, $disabled', '
global $context, $ID_MEMBER, $db_prefix, $user_info, $txt;
if (!empty($context[\'current_topic\']) && !$user_info[\'is_guest\'])
{
$request = mysql_query("
SELECT ID_MSG FROM {$db_prefix}messages
WHERE ID_MEMBER = $ID_MEMBER
AND ID_TOPIC = $context[current_topic]
LIMIT 1");

if (mysql_num_rows($request))
$data;
else
$data = $txt[\'hide_tag_a\'];
mysql_free_result($request);
}
elseif ($user_info[\'is_guest\'])
{
$data = $txt[\'hide_tag_b\'];
}

$cache_id = "";
'),
),


this part of the code:
if (mysql_num_rows($request))
$data;


Data is the actual stuff behind[hide] right?
So can you edit it so it says something like:
if (mysql_num_rows($request))
[color=red]Hidden Text:[/color] '.$data.';


Is that possible?

You would change this line instead:

                              'content' => '<b>$1</b>',


to


                              'content' => '<span style="color: red;">Hidden text:</span> <b>$1</b>',
Title: Re: SMF [hide] BBCode
Post by: Snickers on September 26, 2005, 02:47:30 PM
(Doesn't feel stupid at all) :P


(Thanks  ;D )
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on October 02, 2005, 04:44:17 AM
if you want only admins and mods to see hidden text without replying:
For SMF 1.1 RC 1 only

Find in Sources/Subs.php
                $codes = array(

add after

array(
'tag' => 'hide',
'type' => 'unparsed_content',
'content' => '<b>$1</b>',
'validate' => create_function('&$tag, &$data, $disabled', '
global $context, $ID_MEMBER, $db_prefix, $user_info, $txt;
if (!empty($context[\'current_topic\']) && !$user_info[\'is_guest\'])
{
$request = mysql_query("
SELECT ID_MSG FROM {$db_prefix}messages
WHERE ID_MEMBER = $ID_MEMBER
AND ID_TOPIC = $context[current_topic]
LIMIT 1");

if (mysql_num_rows($request) || allowedTo(\'moderate_forum\'))
$data;
else
$data = $txt[\'hide_tag_a\'];
mysql_free_result($request);
}
elseif ($user_info[\'is_guest\'])
{
$data = $txt[\'hide_tag_b\'];
}

$cache_id = "";
'),
),


note that the only drawback to this is that to admins and mods, the content between the hidden tags will display as unparsed.
Title: Re: SMF [hide] BBCode
Post by: edi67 on October 04, 2005, 01:50:35 AM
Elijah thanx all work good but one little problem, i DISABLE function Admin -> Posts and Topics -> Bulletin Board Code
Un-check the box next to "Automatically link posted URLs"

if this function is DISABLE all work good

all words inside HIDE TAG appear so:

Reg Info [img]http://img26.echo.cx/img26/7083/cura1dg.gif[/img]
Email: [b][email protected][/ b]
Password: [b]Forumzone[/b]
License Key: [b]8ZGD7HX7-9TXR87WY-4BACYB6G-3J7F6DYM[/b]
Credit Card: [b]8345[/b]


with TAG BBC all bold and not functionaly

some solution for solve?
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on October 04, 2005, 03:13:07 AM
Quote from: edi67 on October 04, 2005, 01:50:35 AM
Elijah thanx all work good but one little problem, i DISABLE function Admin -> Posts and Topics -> Bulletin Board Code
Un-check the box next to "Automatically link posted URLs"

if this function is DISABLE all work good

all words inside HIDE TAG appear so:

Reg Info [img]http://img26.echo.cx/img26/7083/cura1dg.gif[/img]
Email: [b][email protected][/ b]
Password: [b]Forumzone[/b]
License Key: [b]8ZGD7HX7-9TXR87WY-4BACYB6G-3J7F6DYM[/b]
Credit Card: [b]8345[/b]


with TAG BBC all bold and not functionaly

some solution for solve?

As I stated before, the content between the hide tag is unparsed. Following [Unknown]'s comments on how to make BBC tags with the new BBC engine in place, this is the only combination I could get to work:

                      array(
                               'tag' => 'hide',
                              'type' => 'unparsed_content',
                              'content' => '<b>$1</b>',
                              'validate' => 'if ($hide_text !== false)...                          
                        ),


omit "type" or change "type" to anything but "unparsed" then the hidden content will become visible regardless of validation.

If there is a solution it is currently beyond the scope of my PHP knowledge.
Title: Re: SMF [hide] BBCode
Post by: edi67 on October 04, 2005, 03:38:35 AM
i tryed you code:

                      array(
                               'tag' => 'hide',
                              'type' => 'unparsed_content',
                              'content' => '<b>$1</b>',
                              'validate' => 'if ($hide_text !== false)...                         
                        ),


but pity the results is the same...  :-[ if i omit TYPE TAG HIDE have not effect, as you told me.

i hope somebody find one solution
Title: Re: SMF [hide] BBCode
Post by: Snickers on October 11, 2005, 07:59:00 AM
Quote from: FaSan on January 29, 2005, 01:05:00 PM
For not quotable code ... open Post.php:


<search>
// Add a quote string on the front and end.
</search>

<add before>
$form_message = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), '', $form_message);
</add before>



;)


FaSan

[/quote]

[quote author=FaSan link=topic=20652.msg205896#msg205896 date=1107191078]
For quote from quick reply, change this (in Post.php) :


[code]
<search>
// Add a quote string on the fron and end.
</search>

<add before>
$row['body'] = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), '', $row['body']);
</add before>





FaSan ;)

These seems to be causing a line screw up when pressing preview in the "post panel"..

HeLP![/code]
Title: Re: SMF [hide] BBCode
Post by: L.G.S on October 11, 2005, 10:46:29 AM
OK I know there was a code to help me in the above posts, but I didn't quite get it.

I'm looking for a way to show images after replying?
Title: Re: SMF [hide] BBCode
Post by: L.G.S on October 16, 2005, 07:24:28 AM
Is  there any news on how to show images in reply?

Also also the URLs posted in the hide do not link.

I also have another question, can I somehow make it so the 'you have to reply' text is an image? I have tried adding (http://link) to the modification.english.php file but that did not help
Title: ONE bug: SMF [hide] BBCode
Post by: edi67 on October 21, 2005, 01:14:28 PM
Tip work good but one bug, looking List of recent Topics, i can see the content of post with TAG HIDE without asnwer to post.

some solution ?
Title: Re: ONE bug: SMF [hide] BBCode
Post by: ディン1031 on October 26, 2005, 04:40:15 PM
Quote from: edi67 on October 21, 2005, 01:14:28 PM
Tip work good but one bug, looking List of recent Topics, i can see the content of post with TAG HIDE without asnwer to post.

some solution ?
Hehe i've updated today my small mod version :X and this problem don't come there :).

Use it on your own risk *runs* (http://mods.simplemachines.org/index.php?mod=118)

Bye
DIN1031
Title: Re: SMF [hide] BBCode
Post by: SunZeroX on October 29, 2005, 03:16:02 PM
The mod is exactly what I need since there isn't a download mod. But I'm wondering what I must edit to make members see the hidden text without having to post in the topic. Anyone can help me out?
Title: Re: SMF [hide] BBCode
Post by: L.G.S on October 30, 2005, 11:02:20 AM
Is there any one here at aall that can help me with my problem?
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on November 20, 2005, 04:52:08 AM
Quote from: edi67 on October 04, 2005, 01:50:35 AM
Elijah thanx all work good but one little problem, i DISABLE function Admin -> Posts and Topics -> Bulletin Board Code
Un-check the box next to "Automatically link posted URLs"

if this function is DISABLE all work good

all words inside HIDE TAG appear so:

Reg Info [img]http://img26.echo.cx/img26/7083/cura1dg.gif[/img]
Email: [b][email protected][/ b]
Password: [b]Forumzone[/b]
License Key: [b]8ZGD7HX7-9TXR87WY-4BACYB6G-3J7F6DYM[/b]
Credit Card: [b]8345[/b]


with TAG BBC all bold and not functionaly

some solution for solve?

Try this:

array(
'tag' => 'hide',
'type' => 'unparsed_content',
'content' => '<b>$1</b>',
'validate' => create_function('&$tag, &$data, $disabled', '
global $context, $ID_MEMBER, $db_prefix, $user_info, $txt;
if (!empty($context[\'current_topic\']) && !$user_info[\'is_guest\'])
{
$request = mysql_query("
SELECT ID_MSG FROM {$db_prefix}messages
WHERE ID_MEMBER = $ID_MEMBER
AND ID_TOPIC = $context[current_topic]
LIMIT 1");

if (mysql_num_rows($request) || allowedTo(\'moderate_forum\'))
$data = doUBBC($data);
else
$data = $txt[\'hide_tag_a\'];
mysql_free_result($request);
}
elseif ($user_info[\'is_guest\'])
{
$data = $txt[\'hide_tag_b\'];
}

$cache_id = "";
'),
),
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on November 20, 2005, 05:24:57 AM
Quote from: edi67 on October 21, 2005, 01:14:28 PM
Tip work good but one bug, looking List of recent Topics, i can see the content of post with TAG HIDE without asnwer to post.

some solution ?

Code (Find in Recent.php) Select

$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']);


Code (add before) Select

if ($context['user']['is_guest'])
{
$row['body'] = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), $txt['hide_tag_b'], $row['body']);
}
else
{
$row['body'] = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), $txt['hide_tag_a'], $row['body']);
}
Title: Re: SMF [hide] BBCode
Post by: diane_tt on December 07, 2005, 02:18:37 PM
^ yes you should be able to but that is because you are admin. other users will see [HIDE] or your image for [HIDE] hope this helps
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on December 07, 2005, 10:12:13 PM
Quote from: diane_tt on December 07, 2005, 02:18:37 PM
^ yes you should be able to but that is because you are admin. other users will see [HIDE] or your image for [HIDE] hope this helps

I don't quite follow, are you saying the code doesn't work? It works when I tested it with regular users and guests.
Title: Re: SMF [hide] BBCode
Post by: VenimK on December 08, 2005, 02:22:50 AM
Quote from: src on December 30, 2004, 09:53:01 AM
doesn't work fer me :(

I got:
Parse error: parse error, unexpected T_STRING, expecting ')' in /home/srecka/public_html/forums/Sources/Subs.php on line 1882

Also running with parse erros in smf 1.1 rc1
Title: Re: SMF [hide] BBCode
Post by: diane_tt on December 08, 2005, 07:40:05 AM
Quote from: Elijah Bliss on December 07, 2005, 10:12:13 PM
Quote from: diane_tt on December 07, 2005, 02:18:37 PM
^ yes you should be able to but that is because you are admin. other users will see [HIDE] or your image for [HIDE] hope this helps

I don't quite follow, are you saying the code doesn't work? It works when I tested it with regular users and guests.

the code works but for guests and for regular members or any moderators it will not show the hidden content in your recent topics. if you are the person that has already replied, or person that has started the topic, or have admin status and you're viewing recent topics - it will show the hidden content. hope my english is clear  ???
Title: Re: SMF [hide] BBCode
Post by: Unnamed~ on January 11, 2006, 08:41:44 PM
This code Works in RC2?  :P
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on January 11, 2006, 09:57:17 PM
Quote from: Unnamed~ on January 11, 2006, 08:41:44 PM
This code Works in RC2?  :P

Try the attached package RC2 Only!
Title: Re: SMF [hide] BBCode
Post by: L.G.S on January 12, 2006, 12:31:15 PM
I installed that, but get no option in admin and everyone can see it :(
Title: Re: SMF [hide] BBCode
Post by: Kirby on January 12, 2006, 05:39:43 PM
Hm, I need to look into an updated version of this sometime.
Title: Re: SMF [hide] BBCode
Post by: Unnamed~ on January 12, 2006, 10:06:12 PM
Quote from: Elijah Bliss on January 11, 2006, 09:57:17 PM
Quote from: Unnamed~ on January 11, 2006, 08:41:44 PM
This code Works in RC2?  :P

Try the attached package RC2 Only!

Thanks, works perfect ;)
Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on January 12, 2006, 10:18:32 PM
Quote from: The Outsider on January 12, 2006, 12:31:15 PM
I installed that, but get no option in admin and everyone can see it :(

Sorry about that, I forgot 2 language strings. Download the package again and reinstall.
Title: Re: SMF [hide] BBCode
Post by: Unnamed~ on January 12, 2006, 10:34:13 PM
Where i change the permision of the HIDE tag?

When a user use this tag appear a mesege whit this "You do not have permission to hide text" or similar.

Title: Re: SMF [hide] BBCode
Post by: Elijah Bliss on January 12, 2006, 11:24:42 PM
Quote from: Unnamed~ on January 12, 2006, 10:34:13 PM
Where i change the permision of the HIDE tag?

In the permissions area, but you'll probably have to uninstall and reinstall the latest mod because I forgot the language strings for the persmissions.

Quote
When a user use this tag appear a mesege whit this "You do not have permission to hide text" or similar.

"You do not have permission to hide text."
Title: Re: SMF [hide] BBCode
Post by: Unnamed~ on January 13, 2006, 12:00:06 AM
Works perfectly, thanks.
Title: Re: SMF [hide] BBCode
Post by: rokit on March 02, 2006, 05:31:50 PM
Thanks for the code, works fine at first attempt. [for me]  This is great for leechers, although there comes spammers.  Is there a code where it forces members to post more than one liners.  XD
Title: Re: SMF [hide] BBCode
Post by: L.G.S on March 26, 2006, 03:53:57 PM
http://mods.simplemachines.org/index.php?mod=290
Title: Re: SMF [hide] BBCode
Post by: Fusion on April 17, 2006, 08:25:55 PM
Am I right in thinking this works like [hide]Text[/hide]? If so, it doesn't work (RC2) :(
Title: Re: SMF [hide] BBCode
Post by: rokit on May 02, 2006, 10:24:48 PM
I like the new hide feature, although I have a problem.  Members are still allowed to download without posting.  They can easily quote the hide message and it will show up like "[hide]link here[/hide]" and they can get away without posting. 

Example:
QuoteMusic Video

[hide]Download (http://www.yousendit.com/download)[/hide]

Is there a function where I can disable quoting in one section, or how cand I fix this?
Thanks!
Title: Re: SMF [hide] BBCode
Post by: L.G.S on May 03, 2006, 11:17:33 AM
That fix is on the 2nd or 3rd page of this thread
Title: Re: SMF [hide] BBCode
Post by: Aleko on May 18, 2006, 10:20:03 AM
Quote from: Elijah Bliss on January 11, 2006, 09:57:17 PM
Try the attached package RC2 Only!

This mod doesn't work for me, I keep getting text in bold between hide tags

I tried 3 times to apply it, is there any pre-requisite ?
Title: Re: SMF [hide] BBCode
Post by: L.G.S on May 18, 2006, 10:45:25 AM
That's what the hack does, hide the text then makes it show bold upon reply
Title: Re: SMF [hide] BBCode
Post by: Aleko on May 19, 2006, 02:44:44 AM
But when I disconnect, I can still see the text in bold, it is not hidden :'( :'( :'(
Title: Re: SMF [hide] BBCode
Post by: Vinspire on May 20, 2006, 06:51:12 AM
So, i need to edit the files like post #1 instruction ? No mod available for this yet right or i've missed it ?  :o :o :o
Title: Re: SMF [hide] BBCode
Post by: L.G.S on May 20, 2006, 06:54:21 AM
There are 3 mods made

http://mods.simplemachines.org/?action=search;basic_search=hide
Title: Re: SMF [hide] BBCode
Post by: Vinspire on May 20, 2006, 10:29:16 PM
Quote from: L.G.S on May 20, 2006, 06:54:21 AM
There are 3 mods made

http://mods.simplemachines.org/?action=search;basic_search=hide

So, which do you recommend ?

Tried Hide Post but its not working. Dont know why but didn't bother checking it.

Tried Hide Tag Special but i wanted to have a working BBC button for it.

Tried Hide Tag but there is an error when installing it.

1.     Execute Modification     ./Sources/Subs.php     Test failed
Title: Re: SMF [hide] BBCode
Post by: L.G.S on May 22, 2006, 03:14:36 PM
Well on my SMF 1.1RC2 forum the HIDE POST mod worked great.

Maybe it didn't work because you did it wrong.

You do not use hide tags, instead you click additional options and then choose your hide from there
Title: Re: SMF [hide] BBCode
Post by: sbm on October 21, 2006, 04:18:05 AM
Hi
Im using smf1.1rc2........

Tried Hide Post but its not working. Dont know why but didn't bother checking it.

Tried Hide Tag Special but i wanted to have a working BBC button for it.

Tried Hide Tag but there is an error when installing it.

1.     Execute Modification     ./Sources/Subs.php     Test failed

Any suggestion.....
Title: Re: SMF [hide] BBCode
Post by: majestic13 on October 27, 2006, 10:48:03 PM
i read a the posts here, but there is no solution for my problem.

i get this error every time a user want to view the (hidden) post:
Notice: Undefined index: hide_tag_b in /www/.../.../celebrana/forum/Sources/Subs.php on line 1047

im using 1.0.8 and this is the code in the subs.php

// [hide]Guests cannot see this! Mwahaha![/hide]
$codefromcache[] = '~\[hide\](.+?)\[/hide\]~i';
if (isset($disabled['hide']) || $user_info['is_admin'])
    $codetocache[] = '$1';
    else
    {
if (!empty($context['current_topic']) && !$user_info['is_guest'])
{
$request = mysql_query("
SELECT ID_MSG FROM {$db_prefix}messages
WHERE ID_MEMBER = $ID_MEMBER
AND ID_TOPIC = $context[current_topic]
LIMIT 1");

if (mysql_num_rows($request))
$codetocache[] = '<b>$1</b>';
else
$codetocache[] = $txt['hide_tag_a'];
mysql_free_result($request);
    }
    else
    $codetocache[] = $txt['hide_tag_b'];
      }


what can i do?
Title: Re: SMF [hide] BBCode
Post by: Edurg on February 28, 2007, 07:16:09 AM
hide tag bbc mod done for my:
http://custom.simplemachines.org/mods/index.php?mod=704
regards ;)
Title: Re: SMF [hide] BBCode
Post by: pongsak on March 25, 2007, 01:41:19 PM
smf 1.1.2 with dilber mc theme mod and many mod installed.
Hide tag work great!  :)
But i think there's some weak point in this mod.
That's i install mouse over...to preview message at the topic (something like that, i can't remember mod name)
When i do this it's show every message that hide but in short message. ( i log in as regular member not admin)
No one mention this before.

Title: Re: Hide mod
Post by: desimatrix on April 18, 2007, 06:00:14 PM
Ok.. have a question..

I have installed HIDE mod.. by Leaf..

but have no clue how to use it.. it is not working as [hide] ... [/hide]

how to have HIDE POST working..

so I can have guest either reply or register to reply and see the post..?
Title: Re: Hide mod
Post by: Kindred on April 18, 2007, 06:20:19 PM
what the heck does the hide mod have to do with the visual warning mod?

Please post mod questions in the thread dedicated to that mod.
Title: Re: Hide mod
Post by: ディン1031 on April 19, 2007, 05:52:49 AM
Quote from: desimatrix on April 18, 2007, 06:00:14 PM
Ok.. have a question..

I have installed HIDE mod.. by Leaf..

but have no clue how to use it.. it is not working as [hide] ... [/hide]

how to have HIDE POST working..

so I can have guest either reply or register to reply and see the post..?
It work with options of the post, there you can set what kind of hiding you use for the complete post. For bbc [hide] you must use the hide tag special.

Bye
DIN1031
Title: Re: SMF [hide] BBCode
Post by: Vyache on February 01, 2010, 01:26:11 AM
Any chance for SMF 2 RC2.0?
Title: Re: SMF [hide] BBCode
Post by: ディン1031 on February 01, 2010, 05:24:41 AM
Quote from: Vyache on February 01, 2010, 01:26:11 AM
Any chance for SMF 2 RC2.0?
Look at the first post... there are descriptions to the modifications which do this kind of things...
Title: Re: SMF [hide] BBCode
Post by: grigori on June 29, 2010, 11:54:53 AM
No hide do not wirks.
Title: Re: SMF [hide] BBCode
Post by: ディン1031 on June 30, 2010, 03:12:44 AM
Quote from: grigori on June 29, 2010, 11:54:53 AM
No hide do not wirks.
And what should tell us this?
Title: Re: SMF [hide] BBCode
Post by: MsAdvantageous on December 08, 2010, 06:46:10 PM
thank you ^_^