Advertisement:
NameCheap

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

Offline Kirby

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,040
  • Gender: Male
SMF [hide] BBCode
« on: November 28, 2004, 12:40:58 PM »
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:
Code: [Select]
global $modSettings, $scripturl, $txt, $settings, $context;
Add after:
Code: [Select]
global $ID_MEMBER, $db_prefix, $user_info;
Look for:
Code: [Select]
// Moving text... [move]stuff[/move]
Add before:
Code: [Select]
// [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:
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>';

Enjoy :D

Coming soon for this mod:
optional BBC button
.mod format/package server
« Last Edit: August 02, 2006, 04:34:56 PM by Jay The Code Monkey »

Offline ANARCH¥

  • Semi-Newbie
  • *
  • Posts: 80
Re: SMF [hide] BBCode
« Reply #1 on: November 28, 2004, 04:08:42 PM »
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

Offline Kirby

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,040
  • Gender: Male
Re: SMF [hide] BBCode
« Reply #2 on: November 28, 2004, 05:02:30 PM »
It can be readable by admins no matter what...

Offline ANARCH¥

  • Semi-Newbie
  • *
  • Posts: 80
Re: SMF [hide] BBCode
« Reply #3 on: November 28, 2004, 05:13:11 PM »
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?
« Last Edit: November 28, 2004, 05:21:18 PM by ANARCH¥ »

Offline A.M.A

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,133
  • Gender: Male
  • ..
Re: SMF [hide] BBCode
« Reply #4 on: November 28, 2004, 05:17:51 PM »
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 :)

Offline Kirby

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,040
  • Gender: Male
Re: SMF [hide] BBCode
« Reply #5 on: November 28, 2004, 06:40:34 PM »
What version of SMF are you using?

Offline ANARCH¥

  • Semi-Newbie
  • *
  • Posts: 80
Re: SMF [hide] BBCode
« Reply #6 on: November 29, 2004, 07:01:28 AM »
well, rc1 upgraded to rc2

Offline edi67

  • SMF Hero
  • ******
  • Posts: 1,532
  • Gender: Male
  • Italian Supporter
    • CrazyZone
Re: SMF [hide] BBCode
« Reply #7 on: November 29, 2004, 09:26:12 AM »
work perfectly for me
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Offline ANARCH¥

  • Semi-Newbie
  • *
  • Posts: 80
Re: SMF [hide] BBCode
« Reply #8 on: November 29, 2004, 01:24:27 PM »
can i uninstall parser mod and reinstall it ?

Offline Kirby

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,040
  • Gender: Male
Re: SMF [hide] BBCode
« Reply #9 on: November 29, 2004, 07:11:11 PM »
Oh; no wonder. Then just add the line after the one you found.

Offline ANARCH¥

  • Semi-Newbie
  • *
  • Posts: 80
Re: SMF [hide] BBCode
« Reply #10 on: December 02, 2004, 09:21:04 PM »
i had to desinstall fastparser code and now its working good...thx.

Offline allfripou

  • Semi-Newbie
  • *
  • Posts: 52
Re: SMF [hide] BBCode
« Reply #11 on: December 03, 2004, 03:24:26 PM »
works very well

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

Offline Kirby

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,040
  • Gender: Male
Re: SMF [hide] BBCode
« Reply #12 on: December 03, 2004, 07:56:30 PM »
glad to hear its working :P
ill be releasing a .mod/package manager version soon too...

Offline edi67

  • SMF Hero
  • ******
  • Posts: 1,532
  • Gender: Male
  • Italian Supporter
    • CrazyZone
Re: SMF [hide] BBCode
« Reply #13 on: December 04, 2004, 08:41:57 AM »
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

Offline src

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

Offline ThaiAnime

  • Newbie
  • *
  • Posts: 4
  • Gender: Female
  • I live in Thailand.
    • Thai Berryz Kobo
Re: SMF [hide] BBCode
« Reply #15 on: January 01, 2005, 01:29:51 AM »
Oh! Thank you.

Offline FaSan

  • Sophist Member
  • *****
  • Posts: 1,053
  • Gender: Male
  • http://www.smitaly.net
    • SMitaly - Supporto a SMF
Re: SMF [hide] BBCode
« Reply #16 on: January 02, 2005, 05:55:48 AM »
I have need that the message within the code [hide] is not quotable...

where it is the code of the quotas ?




FaSan

Offline XanTrax

  • Newbie
  • *
  • Posts: 7
Re: SMF [hide] BBCode
« Reply #17 on: January 19, 2005, 06:42:45 PM »
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..........

Offline XanTrax

  • Newbie
  • *
  • Posts: 7
Re: SMF [hide] BBCode
« Reply #18 on: January 19, 2005, 06:48:38 PM »
nevermind it works :D

Offline FaSan

  • Sophist Member
  • *****
  • Posts: 1,053
  • Gender: Male
  • http://www.smitaly.net
    • SMitaly - Supporto a SMF
Re: SMF [hide] BBCode
« Reply #19 on: January 29, 2005, 01:05:00 PM »
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