TinyPortal

Development => Support => Topic started by: jepot on October 09, 2008, 01:18:54 AM

Title: How to hide blocks from admin? [SOLVED]
Post by: jepot on October 09, 2008, 01:18:54 AM
Link to my site: Its a private forum
SMF version: SMF 1.1.6
TP version: TP 0.983
Theme name and version: Neon by Tippmaster
Mods installed: Adv Sb 2.1 and RSS Feed Poster
Related Error messages: None

I would like to know how to show a block to guest only but hide it from members including admin.

I hope this would be possible.
Title: Re: How to hide blocks from admin?
Post by: JPDeni on October 09, 2008, 01:31:01 AM
Someone else asked this just a day or so ago. At this moment, there is no setting to allow a block to be hidden from admins. I don't know if that option will be in later versions or not.

You can make a php block that has different content for different groups, which can make it appear that the block is hidden from admins, if you do not have the title and the frame for the block. However, the easier way to do it is to just allow the block to be collapsed and have the admin collapse it.
Title: Re: How to hide blocks from admin?
Post by: jepot1 on October 09, 2008, 01:51:05 AM
Quote from: JPDeni on October 09, 2008, 01:31:01 AM
Someone else asked this just a day or so ago. At this moment, there is no setting to allow a block to be hidden from admins. I don't know if that option will be in later versions or not.

You can make a php block that has different content for different groups, which can make it appear that the block is hidden from admins, if you do not have the title and the frame for the block.

I want to learn that. The block is html.
Title: Re: How to hide blocks from admin?
Post by: Ianedres on October 09, 2008, 02:00:19 AM
You will have to use a php article in order to exclude the admin from seeing the information.

This code would display only to a guest. You would have to use echo statements or use the include statement (see php.net for that function) to output your html from that point.

global $context;

if($context['user']['is_guest'])
{
//  php echo statements for html or use include to link to external file
}


Title: Re: How to hide blocks from admin?
Post by: jepot1 on October 09, 2008, 02:31:09 AM
It works,

can it be changed so that if user is not guest it will show a different html page?
Title: Re: How to hide blocks from admin?
Post by: Ianedres on October 09, 2008, 02:34:19 AM
Here ya go...

global $context;

if($context['user']['is_guest'])
{
//  php echo statements for html or use include to link to external file
}
else
{
// non-guest display
}
Title: Re: How to hide blocks from admin?
Post by: Ianedres on October 09, 2008, 02:35:38 AM
I forgot to add that you can change 'is_guest' to 'is_admin' to make different variations on what to display or not.
Title: Re: How to hide blocks from admin?
Post by: jepot1 on October 09, 2008, 02:41:22 AM
Thank you
Title: Re: How to hide blocks from admin?
Post by: Ianedres on October 09, 2008, 02:43:47 AM
You are very welcome. Marking as SOLVED.
Title: Re: How to hide blocks from admin? [SOLVED]
Post by: Thurnok on October 09, 2008, 11:30:56 PM
This was actually solved long ago...

http://www.tinyportal.net/index.php/topic,15456.0.html

Still comes up in the search by the way.
Title: Re: How to hide blocks from admin? [SOLVED]
Post by: Ianedres on October 09, 2008, 11:55:58 PM
Duly noted T.  ;)
Title: Re: How to hide blocks from admin? [SOLVED]
Post by: Thurnok on October 12, 2008, 07:32:30 AM
LOL.. no worries... we keep getting a fresh recycle of previous questions all the time.