Created
January 25, 2017 10:21
-
-
Save martsie/25a02bac386535f07b645071d1e942ff to your computer and use it in GitHub Desktop.
Example of denying access to a Drupal 7 node
This file contains hidden or 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 | |
/** | |
* Implements hook_node_access(). | |
* | |
* Runs every time a user tries to view a node on the website. | |
*/ | |
function my_custom_module_node_access($node, $op, $account) { | |
if ($node->type == 'page' && $op == 'view' && !user_access('my custom permission')) { | |
return NODE_ACCESS_DENY; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment