• Welcome to Simple Machines Community Forum. Please login or sign up.
October 28, 2021, 02:34:09 AM

News:

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


Hide Code Blocks From Guests

Started by Rohan_, September 10, 2009, 03:31:49 PM

Previous topic - Next topic

Rohan_

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
Proud To Be An Indian

DonGiovanni


Rohan_

its not worth it .. i have 10000+ topics already .. i want to hide them too .. i want all code blocks to be hidden automatically
Proud To Be An Indian

Adish - (F.L.A.M.E.R)

You want to hide a whole board or individual topics ?

Rohan_

only the code blocks inside a topic . not full post
Proud To Be An Indian

sAce

are you taking about the php codes or BBC codes, ?? ( [code][/code] ) ??

Rohan_

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
Proud To Be An Indian


Rohan_

noo Flamer .. what about my existing 40000+ topics  with code blocks ? i want every exist code blocks to be hidden automatically tooo
Proud To Be An Indian

Arantor

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.
No good deed goes unpunished
All helpful urges should be circumvented

Rohan_

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" ???
Proud To Be An Indian

Arantor

*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";
No good deed goes unpunished
All helpful urges should be circumvented

Rohan_

ahhh please make it bold and red and please link the login and register text to login and register page :D thanks
Proud To Be An Indian

Arantor

*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.
No good deed goes unpunished
All helpful urges should be circumvented

Rohan_

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
Proud To Be An Indian

Arantor

See reply 13. It has the changes in bold and red.
No good deed goes unpunished
All helpful urges should be circumvented

Rohan_

i also aksed to link the login and register text to login and register page. .. Thanks a ton Arantor .. really appreciate it
Proud To Be An Indian

Arantor

I'm sure you're capable of doing that.

As I said, I am not going to provide further support.
No good deed goes unpunished
All helpful urges should be circumvented

Rohan_

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
Proud To Be An Indian

Arantor

My fault, I'll admit that.

color:red;"> should have been color:red;\">
No good deed goes unpunished
All helpful urges should be circumvented

Advertisement: