function _publishcontent_publish_access in Publish Content 6
Same name and namespace in other branches
- 5.2 publishcontent.module \_publishcontent_publish_access()
- 7 publishcontent.module \_publishcontent_publish_access()
Access callback for publish action. Only allow access based on permissions and current node status = unpublished
2 calls to _publishcontent_publish_access()
1 string reference to '_publishcontent_publish_access'
- publishcontent_menu in ./
publishcontent.module - Implements of hook_menu().
File
- ./
publishcontent.module, line 84 - Add button to publish or unpublish a node, with access control based on the node type
Code
function _publishcontent_publish_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('publish any content') || user_access('publish own content') && $user->uid == $node->uid || user_access('publish editable content') && node_access('update', $node) || user_access('publish own ' . check_plain($node->type) . ' content', $user) && $user->uid == $node->uid || user_access('publish any ' . check_plain($node->type) . ' content') || user_access('publish editable ' . check_plain($node->type) . ' content') && node_access('update', $node));
}