TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 141
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 61
  • Total: 61

How to hide blocks from admin? [SOLVED]

Started by jepot, October 09, 2008, 01:18:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jepot

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.

JPDeni

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.

jepot1

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.

Ianedres

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
}



jepot1

It works,

can it be changed so that if user is not guest it will show a different html page?

Ianedres

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
}

Ianedres

I forgot to add that you can change 'is_guest' to 'is_admin' to make different variations on what to display or not.


Ianedres

You are very welcome. Marking as SOLVED.

Thurnok

Thurnok
The one, the only!

This website is proudly hosted on Crocweb Cloud Website Hosting.