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,022
  • Total Topics: 21,332
  • Online today: 409
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 209
  • Total: 209

Do not show block for admin?

Started by MrApples, April 25, 2007, 09:56:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MrApples

How can I make it so some blocks will NOT show for administrators. I want to make some blocks meant directly for guests and low-end members, but at the same time I don't want to clutter up the forum for our admins.

akulion

The admin can see all - so u cant hide it from him using any of the options in TP atleast for now

vanguard

I hid my block which contained the admin, gallery, dl, stuff.

:)

Zetan

#3
I have one block 'Welcome Message', guest view only. I can't see it logged in as admin.
It has a background colour and is set:
Do not use Title/Frame
Do not allow block to collapse.

I took the Block number and created a link in another block... hit the link and the Welcome block vanished from admin view:

<a href="javascript: void(0); return false" onclick="toggle('65'); return false" <H3 align="center"><font color="orange">Welcome Shrink</font></h3></a>

Works for me..

[edit] What it does is collapse the block for the members who click the link, so each member who doesn't want to see it needs to click that link.
If you set the block with Title/Frame, you will see a line where the block is.
onclick="toggle('65') is the block number, you can find the number of each block by looking at the View Source and searching for the title of the block you want to hide. Stick the links for each block in a block that only Admins or certain members can see.

You need to view the source before you disable the collapse option in the blocks options.


This is the Source code for my Site Navigation block:
<a href="javascript: void(0); return false" onclick="toggle('205'); return false"><img id="blockcollapse205" style="margin: 0;" align="right" src="http://labradio.co.uk/" border="0" alt="" /></a><a href="http://labradio.co.uk/index.php?action=tpadmin;blockeditl=205;sesc=9f3601c29508303f2ea72cf2e8f4f16"><img border="0" style="margin-right: 4px;" align="right" src="http://labradio.co.uk/Themes/azure_Silver_test/images/tp-edit.gif" alt="" /></a>Site Navigation
</div>


I have removed some parts of the code.


Thurnok

Quote from: Thurnok on December 03, 2006, 10:36:17 PM

By the way, you can hide a php block from admins if you follow a few settings rules.
- make a php block
- set it to "Do not use title/frame"
- set it to "Do not allow block to collapse"
- make sure you add the $context variable to global in your phpblock code at the top (global $context;)
- below the global statement, use an if statement to exclude admins ($context['user']['is_admin'])
Sample code:

// your comments at top of code
global $context; // can add your other global vars as well to the same line
// exclaimation point ( ! ) means NOT
if (!$context['user']['is_admin']){
  // all your code that should be displayed in block goes here
}


Anyway, that will work if you want to have some membergroups see a certain block, but you do not want to see it as an admin
Thurnok
The one, the only!

Zetan

Or if you know code like I don't  :laugh:

Thurnoks post is better to follow than mine. My way works for me  ;)

Thurnok

Keep in mind, mine only works for a phpblock, so don't discount yourself Z ;)
Thurnok
The one, the only!

MrApples

Not to sound rude or anything, but this really needs to be a built-in feature for the next version, I don't see why it wasn't in the beginning. Will make a big change, as teaching new members to post is a big part, especially with SMF. I don't get it myself, but alot of people complain that SMF is "too confusing" to me and refuse to post.

Lord Anubis

If you haven't done so already, enable the quick reply it makes it easier for ppl to at least reply to posts, and it will make it less confusing to your members

Crystallas

I noticed that the smf ads mod had an option to hide those added tables from admins. I dont know how they did this, but it makes some sense to me to figure this out. It can be used for more than just ads :)

This website is proudly hosted on Crocweb Cloud Website Hosting.