SMF [hide] BBCode

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

Previous topic - Next topic

Kirby

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://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

ANARCH¥

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

Kirby

It can be readable by admins no matter what...

ANARCH¥

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

A.M.A

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.
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Kirby

What version of SMF are you using?

ANARCH¥


edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

ANARCH¥

can i uninstall parser mod and reinstall it ?

Kirby

Oh; no wonder. Then just add the line after the one you found.

ANARCH¥

i had to desinstall fastparser code and now its working good...thx.

allfripou

works very well

I have made a small mod package for RC2 out of it if anyone is interested

Kirby

glad to hear its working :P
ill be releasing a .mod/package manager version soon too...

edi67

i waiting your bbc button and correction about QUOTE

thx kirby best work
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

src

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

ThaiAnime


FaSan

I have need that the message within the code [hide] is not quotable...

where it is the code of the quotas ?




FaSan

XanTrax

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..........

XanTrax


FaSan

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

Advertisement: