Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SMF [hide] BBCode

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

Previous topic - Next topic


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.

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';
if (!empty($context['current_topic']) && !$user_info['is_guest'])
$request = mysql_query("
SELECT ID_MSG FROM {$db_prefix}messages
AND ID_TOPIC = $context[current_topic]
LIMIT 1");

if (mysql_num_rows($request))
$codetocache[] = '<b>$1</b>';
$codetocache[] = $txt['hide_tag_a'];
    $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


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

hmmm...dont know what to do


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


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?


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


What version of SMF are you using?



CrazyZone - My SMF Forum

From the difficult the hardening of the man you can see


can i uninstall parser mod and reinstall it ?


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


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


works very well

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


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


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


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



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

where it is the code of the quotas ?



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



For not quotable code ... open Post.php:

// Add a quote string on the front and end.

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