Customizing SMF > Now Available

SMF [hide] BBCode

(1/23) > >>

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:

--- Code: --- global $modSettings, $scripturl, $txt, $settings, $context;
--- End code ---

Add after:

--- Code: --- global $ID_MEMBER, $db_prefix, $user_info;
--- End code ---

Look for:

--- Code: --- // Moving text... [move]stuff[/move]
--- End code ---

Add before:

--- Code: --- // [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'];

--- End code ---

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

Look for:

--- Code: ---?>
--- End code ---

Add before:

--- Code: ---$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>';
--- End code ---

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.


[0] Message Index

[#] Next page

Go to full version