Making a block viewable for Admin only
Permalink
Greetings community. I have a button on my site that I'd only like the admin to see (it's the url to the post button for a new blog entry).
I've done some googling around, but struggle with finding the correct solution. Is there a way to make a block only viewable for an admin?
Right now I'm doing this:
Can I add something to the php to make it only appear for an admin user?
I've done some googling around, but struggle with finding the correct solution. Is there a way to make a block only viewable for an admin?
Right now I'm doing this:
<?php $a = new Area('Blog Button'); $a->display($c); ?>
Can I add something to the php to make it only appear for an admin user?
Hi there! Thanks for the quick reply. Some of the sources I've read warn me about turning on advanced permissions (although I have thought about doing it).
Are there any serious negative effects to turning on advanced settings?
Are there any serious negative effects to turning on advanced settings?
You have more control with advanced permissions
http://legacy-documentation.concrete5.org/editors/dashboard/system-...
http://legacy-documentation.concrete5.org/editors/dashboard/system-...
Edit: Never mind, it seems I had to call the jQuery from google before the header_required php.
--------
Hey there! I 'think' it's working, but I've stumbled upon another problem when testing it out.
When logging out, it no longer runs my jQuery.
However when loading jQuery via google
it no longer works in admin edit mode.
I tried looking for a way where it loads the jQuery in both cases, and found an extention. However this one is out of date and C5 can't install it.
I am working in localhost, if that is of any help.
--------
Hey there! I 'think' it's working, but I've stumbled upon another problem when testing it out.
When logging out, it no longer runs my jQuery.
However when loading jQuery via google
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
it no longer works in admin edit mode.
I tried looking for a way where it loads the jQuery in both cases, and found an extention. However this one is out of date and C5 can't install it.
I am working in localhost, if that is of any help.
You can do this without any code:
Enable advanced permissions for your site.
Then go to the block, click, choose block permissions.
Here you can change all the permissions for that block.
So you can prohibit any user or guest to view the block etc.
I added a screenshot of the block permissions screen.
Hope this helps
Grafoman