News:

Wondering if this will always be free?  See why free is better.

Main Menu

SMF [hide] BBCode

Started by Kirby, November 28, 2004, 12:40:58 PM

Previous topic - Next topic

Snickers

#60
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?

Elijah Bliss

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.

Elijah Bliss

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

Snickers

(Doesn't feel stupid at all) :P


(Thanks  ;D )

Elijah Bliss

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.

edi67

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?
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Elijah Bliss

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.

edi67

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
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Snickers

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]

L.G.S

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?
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


L.G.S

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 to the modification.english.php file but that did not help
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


edi67

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 ?
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

ディン1031

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*

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

SunZeroX

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?

L.G.S

Is there any one here at aall that can help me with my problem?
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Elijah Bliss

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 = "";
'),
),

Elijah Bliss

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']);
}

diane_tt

^ 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

Elijah Bliss

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.

VenimK

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

Advertisement: