Permission-specific styles for people who are logged in
Permalink 1 user found helpfulI am starting to play with permissions and have run into a couple of problems with the style of the site when the editing bar is showing. I was using this to apply a specific style (namely adding an extra 50 or so pixels to the floats in the page so they look right when the edit bar is visible):
<?php $cp = new Permissions($c);if($cp->canAdmin()) { ?>
...but now I have created new groups who are not admins, so it therefore doesn't work for them. I tried this:
<?php $cp = new Permissions($c);if($cp->canWrite()) { ?>
...which works, except that there is at least one page where the only permission I've given is to add new pages to it as children, because I don't want them to be able to alter the parent page. Is there a method for that? Or is there a method which simply tests whether the editing bar is displayed, regardless of permissions? That would be the best solution.
Any thoughts much appreciated :)

That doesn't work - it makes the changes only when the user is in edit mode (i.e. has clicked Edit Page), but not when they are browsing with the c5 bar visible (whether on a page which they can edit or on a page where they can only add subpages).
It would be okay if the c5 bar showed on every page when logged in, because then I could presumably use isLoggedIn or something similar. But since the particular user group I am dealing with has access only to edit/add to a specific part of the site's tree, the c5 bar only shows on those pages and not on the ones where they have no permissions to make changes.
Is it possible, as a workaround, to make the c5 bar show all the time, regardless of permissions? This would also be good from the point of view of letting people know they are logged in.
if ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage()) { // Do something }
This is pulled directly from /concrete/tools/page_controls_menu_js.php, which is the script that actually loads the menu itself.
On a side issue (mentioned above), is it possible to force the banner to always display? Some of my users are less computer-savvy than others, and having the banner display at all times when they are logged in might be a good thing.
SEEMS like this would work, but I'm not really sure. May be more trouble than it's worth...
$u = new User(); $group = $u->getUserGroups(); if (in_array("Name of group", $group) || $u->isSuperUser()) { //do something }