function comment_perm_comment_view_alter in Comment Permissions 7
Same name and namespace in other branches
- 7.2 comment_perm.module \comment_perm_comment_view_alter()
File
- ./
comment_perm.module, line 78 - Module to control commenting permissions by role and by node type.
Code
function comment_perm_comment_view_alter(&$build) {
$types = variable_get('comment_perm_node_types', array());
$form_id_types = array();
if (is_array($types)) {
foreach ($types as $type) {
if ($build['#bundle'] == 'comment_node_' . $type) {
if (!comment_perm_edit_access($build['#node'])) {
unset($build['links']['comment']['#links']['comment-edit']);
}
if (!comment_perm_access($build['#node'])) {
unset($build['links']['comment']['#links']['comment-reply']);
}
return;
}
}
}
}