If you're using Concrete5.6.0 or higher, you can do this:
global $cp;
$canViewToolbar = (isset($cp) && is_object($cp) && $cp->canViewToolbar());
if ($canViewToolbar) {
//do something...
}
If you're doing this in a theme template or block view, you can leave out a lot of that junk and just do this:
global $cp;
if ($cp->canViewToolbar()) {
//do something...
}
If you're running a version of Concrete5 that's older than 5.6, use this code:
global $cp;
$canViewToolbar = (isset($cp) && ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage() || $cp->canApproveCollection()));
if ($canViewToolbar) {
//do something...
}
Loading Conversation