Created
April 26, 2015 23:34
-
-
Save hissy/7c625b5997783ef40705 to your computer and use it in GitHub Desktop.
#concrete5 Check if the block is private or not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// for concrete5.6 | |
// libraries/block_view.php | |
defined('C5_EXECUTE') or die("Access Denied."); | |
class BlockView extends Concrete5_Library_BlockView { | |
public function render($obj, $view = 'view', $args = array()) { | |
$isPrivate = true; | |
$pk = PermissionKey::getByHandle('view_block'); | |
$pk->setPermissionObject($obj); | |
$pa = $pk->getPermissionAccessObject(); | |
if (is_object($pa)) { | |
$pe = GroupPermissionAccessEntity::getOrCreate(Group::getByID(GUEST_GROUP_ID)); | |
$ae = array($pe); | |
if ($pa->validateAccessEntities($ae)) { | |
$isPrivate = false; | |
} | |
} | |
if ($isPrivate) { | |
echo '<div class="private">'; | |
} | |
parent::render($obj, $view, $args); | |
if ($isPrivate) { | |
echo '</div>'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment