TinyPortal

Development => Support => Topic started by: Pravi on August 12, 2016, 09:04:45 AM

Title: Hide Panel/Block when logged in as Admin
Post by: Pravi on August 12, 2016, 09:04:45 AM
Hello guys,

     I want to hide the Panel only for admin. The "Hide panels when in admin section" in panel section seems to not working. Need a little help over here.


Thank you.

Link to my forum: http://pix2box.com
SMF version: 2.0.11
TP version: 1.2
Default Forum Language: English
Theme name and version: Redsy
Browser Name and Version: Chrome and firefox
Mods installed: Tiny portal (only)

Title: Re: Hide Panel/Block when logged in as Admin
Post by: illori on August 12, 2016, 10:05:58 AM
what type of panel are you wanting to hide?
where are you want it hidden?
that setting only works in the admin panel not anywhere else.
Title: Re: Hide Panel/Block when logged in as Admin
Post by: Pravi on August 12, 2016, 03:03:20 PM
Quote from: illori on August 12, 2016, 10:05:58 AM
what type of panel are you wanting to hide?
where are you want it hidden?
that setting only works in the admin panel not anywhere else.

Hi illori,
I want to hide a 'HTML and javascript code' block in admin section.
Title: Re: Hide Panel/Block when logged in as Admin
Post by: illori on August 12, 2016, 09:59:57 PM
you mean that block is showing to the admin and you want to hide it only when in the admin panel? if that option is selected it should hide all the blocks/panels when in the admin panel.
Title: Re: Hide Panel/Block when logged in as Admin
Post by: Pravi on August 13, 2016, 07:33:47 AM
Quote from: illori on August 12, 2016, 09:59:57 PM
you mean that block is showing to the admin and you want to hide it only when in the admin panel? if that option is selected it should hide all the blocks/panels when in the admin panel.

Can you please tell me exactly how to hide a block?


Thank you
Title: Re: Hide Panel/Block when logged in as Admin
Post by: illori on August 13, 2016, 11:10:19 AM
can you instead answer the question i asked? if i understand what you are trying to do then we can tell you what to do to get it done.
Title: Re: Hide Panel/Block when logged in as Admin
Post by: Pravi on August 13, 2016, 06:20:11 PM
Quote from: illori on August 12, 2016, 09:59:57 PM
you mean that block is showing to the admin and you want to hide it only when in the admin panel?

yes i want to hide the block in the admin panel...
Title: Re: Hide Panel/Block when logged in as Admin
Post by: illori on August 13, 2016, 08:13:20 PM
if that option is enabled, it should be hidden already. i dont know how it would show otherwise.
Title: Re: Hide Panel/Block when logged in as Admin
Post by: Pravi on August 15, 2016, 08:41:35 AM
Quote from: illori on August 13, 2016, 08:13:20 PM
if that option is enabled, it should be hidden already. i dont know how it would show otherwise.

Hi illori,
The blocks are hidden in the admin panel but its visible in the forum and all other places .. I want to hide the block when LOGGED in as admin. Not only in admin panel but also in every section of the forum.


Thank you
Title: Re: Hide Panel/Block when logged in as Admin
Post by: lurkalot on August 15, 2016, 08:53:35 AM
Not sure if there's an easier way around this problem, but you could take a look at this solution, http://www.tinyportal.net/index.php?topic=34936.msg279215#msg279215
Title: Re: Hide Panel/Block when logged in as Admin
Post by: illori on August 15, 2016, 10:12:53 AM
Quote from: lurkalot on August 15, 2016, 08:53:35 AM
Not sure if there's an easier way around this problem, but you could take a look at this solution, http://www.tinyportal.net/index.php?topic=34936.msg279215#msg279215

i dont think that will work as admin can see/do everything, so the admin group would override that group.

is this a block that should be visible to guests or just one group and hidden from the admin group?
Title: Re: Hide Panel/Block when logged in as Admin
Post by: lurkalot on August 15, 2016, 06:20:51 PM
Quote from: illori on August 15, 2016, 10:12:53 AM
Quote from: lurkalot on August 15, 2016, 08:53:35 AM
Not sure if there's an easier way around this problem, but you could take a look at this solution, http://www.tinyportal.net/index.php?topic=34936.msg279215#msg279215

i dont think that will work as admin can see/do everything, so the admin group would override that group.

is this a block that should be visible to guests or just one group and hidden from the admin group?

Ok sorry Illori. I guess the other way is to make the html work in a php block and use the trick you gave me a while back to hide it from admin.  Unless you have something else up your sleeve. ;)
Title: Re: Hide Panel/Block when logged in as Admin
Post by: Pravi on August 15, 2016, 07:18:09 PM
Hi.

I just want to hide a block which contains my adsense ads while logged in as admin. I want to avoid accidental clicks on the ads. Can I use css to hide the block only for the admin ??
Title: Re: Hide Panel/Block when logged in as Admin
Post by: illori on August 16, 2016, 10:10:12 AM
no you cant use css to hide it from the admin.

what group(s) should the block be visible to?

if more the just guest, provide the group id number.
Title: Re: Hide Panel/Block when logged in as Admin
Post by: Pravi on August 16, 2016, 10:23:52 AM
Quote from: illori on August 16, 2016, 10:10:12 AM
no you cant use css to hide it from the admin.

what group(s) should the block be visible to?

if more the just guest, provide the group id number.

Hi illori,
I want the block visible only for guest, regular members and moderators.
Title: Re: Hide Panel/Block when logged in as Admin
Post by: illori on August 16, 2016, 10:21:12 PM
global moderators or?
Title: Re: Hide Panel/Block when logged in as Admin
Post by: Pravi on August 17, 2016, 12:37:33 PM
Quote from: illori on August 16, 2016, 10:21:12 PM
global moderators or?

Hide block only for admin. Except admin, it should visible to everyone.
Title: Re: Hide Panel/Block when logged in as Admin
Post by: illori on August 17, 2016, 09:39:18 PM
you would need to use a php block, with code similar to this
i have not tested it but it should work.

global $context
if (!$context['user']['is_admin'])
echo '
<div align="center">
your ad code here
</div>';
Title: Re: Hide Panel/Block when logged in as Admin
Post by: Pravi on August 19, 2016, 03:18:02 PM
Quote from: illori on August 17, 2016, 09:39:18 PM
you would need to use a php block, with code similar to this
i have not tested it but it should work.

global $context
if (!$context['user']['is_admin'])
echo '
<div align="center">
your ad code here
</div>';


Hi illori,
I tried the code, its working fine. Initially it was not working, add a semicolon to global variable and every thing is working fine.

global $context;
if (!$context['user']['is_admin'])
echo '
<div align="center">
your ad code here
</div>';

[/quote]

Thank you illori,
Thank you very much