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

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 08:18:36 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 151
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 142
  • Total: 143
  • tino

Hide Panel/Block when logged in as Admin

Started by Pravi, August 12, 2016, 09:04:45 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

illori

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?

lurkalot

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. ;)

Pravi

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 ??

illori

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.

Pravi

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.

illori


Pravi

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.

illori

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>';

Pravi

#18
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