function _publishcontent_unpublish_access in Publish Content 6
Same name and namespace in other branches
- 5.2 publishcontent.module \_publishcontent_unpublish_access()
- 7 publishcontent.module \_publishcontent_unpublish_access()
Access callback for unpublish action. Only allow access based on permissions and current node status = published
2 calls to _publishcontent_unpublish_access()
1 string reference to '_publishcontent_unpublish_access'
- publishcontent_menu in ./
publishcontent.module - Implements of hook_menu().
File
- ./
publishcontent.module, line 107 - Add button to publish or unpublish a node, with access control based on the node type
Code
function _publishcontent_unpublish_access($node, $token = FALSE) {
if ($token && !drupal_valid_token($token)) {
return FALSE;
}
if (!variable_get('publishcontent_' . $node->type, TRUE)) {
return FALSE;
}
global $user;
return $node->status && (user_access('unpublish any content') || user_access('unpublish own content') && $user->uid == $node->uid || user_access('unpublish editable content') && node_access('update', $node) || user_access('unpublish own ' . check_plain($node->type) . ' content', $user) && $user->uid == $node->uid || user_access('unpublish any ' . check_plain($node->type) . ' content') || user_access('unpublish editable ' . check_plain($node->type) . ' content') && node_access('update', $node));
}