function publishcontent_perm in Publish Content 5.2
Same name and namespace in other branches
- 5 publishcontent.module \publishcontent_perm()
- 6 publishcontent.module \publishcontent_perm()
Implementation of hook_perm().
@note: the 2 extra spaces is a hack: Drupal 5-6 user permissions page set 'publish *all* content' auto-magically when 'unpublish *all* content' is set.
File
- ./
publishcontent.module, line 82 - Add button to publish or unpublish a node, with access control based on the node type
Code
function publishcontent_perm() {
$perms = array(
' publish *all* content',
'unpublish *all* content',
);
foreach (node_get_types() as $type) {
if (isset($type->type)) {
$perms[] = ' publish ' . check_plain($type->type) . ' content';
$perms[] = ' publish own ' . check_plain($type->type) . ' content';
$perms[] = 'unpublish ' . check_plain($type->type) . ' content';
$perms[] = 'unpublish own ' . check_plain($type->type) . ' content';
}
}
return $perms;
}