Composer - Edit Mode

Permalink 1 user found helpful
Have given permission for Registered Users to create a page type in composer however I don't want the Edit Mode button to be available to them. Is this something I can control using permissions or do I have to remove in the code ?

Responsive
 
phreeknomenal replied on at Permalink Reply
I came up with a workaround for this particular issue.

<?php
$cp = new Permissions($c);
$uinfo = new User();
if ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage()) { ?>
<style type="text/css">
div#ccm-toolbar { }
</style>
<?php }  else if ($uinfo->IsLoggedIn()) { ?> 
<style type="text/css">
div#ccm-toolbar { display: none; visibility: hidden;}
</style>
<?php } ?>


First, we want to check to see if the user logging is admin.

if ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage()) { ?>


If yes, no change. (Note: I left a dummy line of CSS in the script for visual purposes. You can delete it)

Then we want to check if the user is logged in under any privilege.

<?php }  else if ($uinfo->IsLoggedIn()) { ?>


If true, then we add CSS to hide the toolbar and remove the gap it leaves.

<style type="text/css">
body { margin: 50px 0 0;}
div#ccm-toolbar { display: none; visibility: hidden;}
</style>


With this code. Any user that logs in as Admin/SuperUser will be able to see the toolbar and edit. It will be hidden from those without the right permissions.
baysmedia replied on at Permalink Reply
Is this code for 5.7? I have tried adding it via a PHP block on a page and it returns with the following error on page load:
Unable to get permission key for write


Am I adding the code via the wrong method (do I need to hard-code it somewhere?) or is this meant for use on 5.6?

Cheers!