Advertisement:

Author Topic: SMF [hide] BBCode  (Read 239988 times)

Offline Snickers

  • Jr. Member
  • **
  • Posts: 127
Re: SMF [hide] BBCode
« Reply #60 on: September 26, 2005, 11:38:45 AM »
For SMF 1.1 RC 1 only

Find in Sources/Subs.php
Code: [Select]
                $codes = array(
add after
Code: [Select]
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:
Code: [Select]
if (mysql_num_rows($request))
$data;

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

Is that possible?
« Last Edit: September 26, 2005, 11:52:06 AM by Snickers »

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: SMF [hide] BBCode
« Reply #61 on: September 26, 2005, 02:18:31 PM »
Don't forget modifications.template.php  :P

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

Look for:
Code: [Select]
?>

Add before:
Code: [Select]
$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.

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: SMF [hide] BBCode
« Reply #62 on: September 26, 2005, 02:22:22 PM »
For SMF 1.1 RC 1 only

Find in Sources/Subs.php
Code: [Select]
                $codes = array(
add after
Code: [Select]
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:
Code: [Select]
if (mysql_num_rows($request))
$data;

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

Is that possible?

You would change this line instead:
Code: [Select]
                              'content' => '<b>$1</b>',

to

Code: [Select]
                              'content' => '<span style="color: red;">Hidden text:</span> <b>$1</b>',

Offline Snickers

  • Jr. Member
  • **
  • Posts: 127
Re: SMF [hide] BBCode
« Reply #63 on: September 26, 2005, 02:47:30 PM »
(Doesn't feel stupid at all) :P


(Thanks  ;D )

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: SMF [hide] BBCode
« Reply #64 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
Code: [Select]
                $codes = array(
add after
Code: [Select]
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.

Offline edi67

  • SMF Hero
  • ******
  • Posts: 1,532
  • Gender: Male
  • Italian Supporter
    • CrazyZone
Re: SMF [hide] BBCode
« Reply #65 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:

Code: [Select]
Reg Info [img]http://img26.echo.cx/img26/7083/cura1dg.gif[/img]
Email: [b]edi67@forumzone.ru[/ 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

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: SMF [hide] BBCode
« Reply #66 on: October 04, 2005, 03:13:07 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:

Code: [Select]
Reg Info [img]http://img26.echo.cx/img26/7083/cura1dg.gif[/img]
Email: [b]edi67@forumzone.ru[/ 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:
Code: [Select]
                      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.

Offline edi67

  • SMF Hero
  • ******
  • Posts: 1,532
  • Gender: Male
  • Italian Supporter
    • CrazyZone
Re: SMF [hide] BBCode
« Reply #67 on: October 04, 2005, 03:38:35 AM »
i tryed you code:

Code: [Select]
                      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

Offline Snickers

  • Jr. Member
  • **
  • Posts: 127
Re: SMF [hide] BBCode
« Reply #68 on: October 11, 2005, 07:59:00 AM »
For not quotable code ... open Post.php:

Code: [Select]
<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]

Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: SMF [hide] BBCode
« Reply #69 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?
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: SMF [hide] BBCode
« Reply #70 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 to the modification.english.php file but that did not help
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline edi67

  • SMF Hero
  • ******
  • Posts: 1,532
  • Gender: Male
  • Italian Supporter
    • CrazyZone
ONE bug: SMF [hide] BBCode
« Reply #71 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 ?
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Offline ディン1031

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,599
  • Gender: Male
  • はるひ! :P
    • ~DIN1031
Re: ONE bug: SMF [hide] BBCode
« Reply #72 on: October 26, 2005, 04:40:15 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

Offline SunZeroX

  • Newbie
  • *
  • Posts: 2
  • Gender: Male
Re: SMF [hide] BBCode
« Reply #73 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?

Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: SMF [hide] BBCode
« Reply #74 on: October 30, 2005, 11:02:20 AM »
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


Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: SMF [hide] BBCode
« Reply #75 on: November 20, 2005, 04:52:08 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:

Code: [Select]
Reg Info [img]http://img26.echo.cx/img26/7083/cura1dg.gif[/img]
Email: [b]edi67@forumzone.ru[/ 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:
Code: [Select]
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 = "";
'),
),

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: SMF [hide] BBCode
« Reply #76 on: November 20, 2005, 05:24:57 AM »
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']);
}

Offline diane_tt

  • Semi-Newbie
  • *
  • Posts: 43
Re: SMF [hide] BBCode
« Reply #77 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

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: SMF [hide] BBCode
« Reply #78 on: December 07, 2005, 10:12:13 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.

Offline VenimK

  • Newbie
  • *
  • Posts: 5
Re: SMF [hide] BBCode
« Reply #79 on: December 08, 2005, 02:22:50 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