Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: Rohan_ on September 10, 2009, 03:31:49 PM

Title: Hide Code Blocks From Guests
Post by: Rohan_ on September 10, 2009, 03:31:49 PM
Hello :( ..


i want a feature ( mod , code ) for hiding the code blocks from the guests ..

example i want to hide
this

from guests

PLEASE HELP
Title: Re: Hide Code Blocks From Guests
Post by: DonGiovanni on September 10, 2009, 06:05:01 PM
Try this mod http://custom.simplemachines.org/mods/index.php?mod=756

It's for 1.1.4 but maybe still working for 1.1.10
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 11, 2009, 02:35:58 AM
its not worth it .. i have 10000+ topics already .. i want to hide them too .. i want all code blocks to be hidden automatically
Title: Re: Hide Code Blocks From Guests
Post by: Adish - (F.L.A.M.E.R) on September 11, 2009, 04:01:19 PM
You want to hide a whole board or individual topics ?
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 12, 2009, 01:17:08 AM
only the code blocks inside a topic . not full post
Title: Re: Hide Code Blocks From Guests
Post by: sAce on September 12, 2009, 01:28:31 AM
are you taking about the php codes or BBC codes, ?? ( [code][/code] ) ??
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 12, 2009, 03:44:18 AM
yea yea bhaii ..

i want to hide all existing and new posting content inside code blocks made using code tags from guests and show them "Hidden Content You Need To Login or Register To See The Hidden Content"

Example

Hide
this

and show
Hidden Content You Need To Login or Register To See The Hidden Content
Title: Re: Hide Code Blocks From Guests
Post by: Adish - (F.L.A.M.E.R) on September 12, 2009, 05:01:57 AM
http://custom.simplemachines.org/mods/index.php?mod=118

That should do it.
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 12, 2009, 01:04:09 PM
noo Flamer .. what about my existing 40000+ topics  with code blocks ? i want every exist code blocks to be hidden automatically tooo
Title: Re: Hide Code Blocks From Guests
Post by: Arantor on September 12, 2009, 01:23:27 PM
In Subs.php, you'll see this block twice.

'validate' => isset($disabled['code']) ? null : create_function('&$tag, &$data, $disabled', '
global $context;


After the first one just add:
if($context["user"]["is_guest"]) $data = "Hidden!!";

After the second one:
if($context["user"]["is_guest"]) $data[0] = "Hidden!!";


I will not be making this into a mod. Take a backup of Subs.php before applying.
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 12, 2009, 01:59:38 PM
Arantor Thanks Big Bro but 1 problem .. can we show the users after hiding the code block
"Hidden Content You Need To Login or Register To See The Hidden Content" ???
Title: Re: Hide Code Blocks From Guests
Post by: Arantor on September 12, 2009, 02:02:04 PM
*sigh*

In Subs.php, you'll see this block twice.

'validate' => isset($disabled['code']) ? null : create_function('&$tag, &$data, $disabled', '
global $context;


After the first one just add:
if($context["user"]["is_guest"]) $data = "Hidden Content You Need To Login or Register To See The Hidden Content";

After the second one:
if($context["user"]["is_guest"]) $data[0] = "Hidden Content You Need To Login or Register To See The Hidden Content";
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 12, 2009, 02:02:52 PM
ahhh please make it bold and red and please link the login and register text to login and register page :D thanks
Title: Re: Hide Code Blocks From Guests
Post by: Arantor on September 12, 2009, 02:04:14 PM
*sigh* *sigh*

In Subs.php, you'll see this block twice.

'validate' => isset($disabled['code']) ? null : create_function('&$tag, &$data, $disabled', '
global $context;


After the first one just add:
if($context["user"]["is_guest"]) $data = "<span style=\"font-weight:bold; color:red;">Hidden Content You Need To Login or Register To See The Hidden Content</span>";

After the second one:
if($context["user"]["is_guest"]) $data[0] = "<span style=\"font-weight:bold; color:red;">Hidden Content You Need To Login or Register To See The Hidden Content</span>";


I will not provide any further support on this matter, however, as a personal choice.
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 12, 2009, 02:05:07 PM
Quote from: Rohan_ on September 12, 2009, 02:02:52 PM
ahhh please make it bold and red and please link the login and register text to login and register page :D thanks
Title: Re: Hide Code Blocks From Guests
Post by: Arantor on September 12, 2009, 02:05:49 PM
See reply 13. It has the changes in bold and red.
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 12, 2009, 02:07:27 PM
i also aksed to link the login and register text to login and register page. .. Thanks a ton Arantor .. really appreciate it
Title: Re: Hide Code Blocks From Guests
Post by: Arantor on September 12, 2009, 02:08:18 PM
I'm sure you're capable of doing that.

As I said, I am not going to provide further support.
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 12, 2009, 02:12:41 PM
Parse error: syntax error, unexpected T_STRING in /home/vhosts/www.site.com/Sources/Subs.php(1206) : runtime-created function on line 4

Parse error: syntax error, unexpected T_STRING in /home/vhosts/www.site.com/Sources/Subs.php(1277) : runtime-created function on line 4
Title: Re: Hide Code Blocks From Guests
Post by: Arantor on September 12, 2009, 02:13:37 PM
My fault, I'll admit that.

color:red;"> should have been color:red;\">
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 12, 2009, 02:19:10 PM
ohh yeah fine .. so now for guests its done .. they see text in a code block now .. finally can u give me a code to add the links ?
Title: Re: Hide Code Blocks From Guests
Post by: Arantor on September 12, 2009, 02:31:13 PM
Quote from: Arantor on September 12, 2009, 02:08:18 PM
I'm sure you're capable of doing that.

As I said, I am not going to provide further support.
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 12, 2009, 02:34:19 PM
" Please "


arantor its a 5 second work for you .. please help me .. can't a big bro help a younger if he requests ?
Title: Re: Hide Code Blocks From Guests
Post by: sAce on September 12, 2009, 02:49:46 PM
<a href="link">title</a>  :D
Title: Re: Hide Code Blocks From Guests
Post by: Arantor on September 12, 2009, 02:53:14 PM
I do not provide support for warez sites as a personal decision. Having had my own material presented ripped off and presented on such sites before, I have no tolerance for it personally.
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 12, 2009, 02:59:42 PM
Quote from: S-Ace on September 12, 2009, 02:49:46 PM
<a href="link">title</a>  :D
bro soumik .. i tried it already but i got a parse error of T_STRING
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 12, 2009, 04:06:13 PM
Hey .. i have a mod for download bb codes .. i also want to hide its content .. this mod uses this code

'tag' => 'down',
'before' => '<table border="0" cellspacing="0" cellpadding="0" width="'.$modSettings['download_width'].'"><tr><td height="39" colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td width="113" background="'.$settings['default_theme_url'].'/images/down1.gif" height="39" title="'.$txt['bbcode_downloadlinks'].'">&nbsp;</td><td background="'.$settings['default_theme_url'].'/images/down2.gif">&nbsp;</td><td width="48" background="'.$settings['default_theme_url'].'/images/down3.gif" height="39" >&nbsp;</td></tr></table></td></tr><tr><td bgcolor="#C0DDFF" width="10">&nbsp;</td><td bgcolor="#C0DDFF"><table border="1" width="100%" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #007FD8" bgcolor="#FFFFFF"><tr><td style="font-family: Arial; font-size: 12px; color: #707070; text-align: center"><p style="margin: 5px">',
'after' => '</td></tr></table></td><td bgcolor="#C0DDFF" width="10">&nbsp;</td></tr><tr><td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td background="'.$settings['default_theme_url'].'/images/down4.gif"  height="11" width="11"><img border="0" src="'.$settings['default_theme_url'].'/images/space.gif" alt="sharedownload.org" width="1" height="1"></td><td bgcolor="#C0DDFF" height="11"><img border="0" src="'.$settings['default_theme_url'].'/images/space.gif" width="1" height="1"></td><td background="'.$settings['default_theme_url'].'/images/down5.gif" height="11" width="11"><img border="0" src="'.$settings['default_theme_url'].'/images/space.gif" width="1" height="1"></td></tr></table></td></tr></table><!-- 120509-->',
'block_level' => true,


now please please last time please tell me where do i add a code to hide its content
Title: Re: Hide Code Blocks From Guests
Post by: Arantor on September 15, 2009, 06:47:23 AM
As ever any changes to modifications should be referred to the mod's own page. We cannot provide support on mods in the main support board.

That said, I'm sure you're a smart guy, look at the changes I described and see how you might apply that to your new tag.
Title: Re: Hide Code Blocks From Guests
Post by: Rohan_ on September 15, 2009, 12:30:41 PM
i tried to add the code .. but i didn't got success .. i fail sometime in somethings .. so please arantor help me in this tag and we will mark this topic solved :)
Title: Re: Hide Code Blocks From Guests
Post by: TheDisturbedOne on September 16, 2009, 07:24:56 PM
Quote from: Arantor on September 12, 2009, 02:53:14 PM
I do not provide support for warez sites as a personal decision. Having had my own material presented ripped off and presented on such sites before, I have no tolerance for it personally.
I agree (and sympathize) with Arantor, so I remain silent here as well.
I'm sure other forums will be able to help you, or possibly other members.
Title: Re: Hide Code Blocks From Guests
Post by: lukasino on September 16, 2009, 07:40:46 PM
Hello i have http://custom.simplemachines.org/mods/index.php?mod=342

This mod is cool but i have one quetion

when user put link in "url" and "quote" mod works but when put in "code" no :( how fix this?
Title: Re: Hide Code Blocks From Guests
Post by: Arantor on September 16, 2009, 07:42:10 PM
Because the mod wasn't written to support code, follow the instructions earlier in this thread which explains how to make it work on code tags too.