function comment_perm_admin_settings in Comment Permissions 5
Same name and namespace in other branches
- 6 comment_perm.admin.inc \comment_perm_admin_settings()
- 7.2 comment_perm.admin.inc \comment_perm_admin_settings()
- 7 comment_perm.admin.inc \comment_perm_admin_settings()
Menu callback; presents the comment_perm settings page.
1 string reference to 'comment_perm_admin_settings'
- comment_perm_menu in ./
comment_perm.module - Implementation of hook_menu().
File
- ./
comment_perm.module, line 27
Code
function comment_perm_admin_settings() {
$form = array();
$form['help'] = array(
'#value' => t("<p>Enable the extended comment permissions for certain content types here.\n Then go to the !user-access-control to configure which roles can post comments for the\n these content types.</p>", array(
'!user-access-control' => l('user access control', 'admin/user/access'),
)),
);
// get node types
$node_types = node_get_types();
foreach ($node_types as $type => $obj) {
switch (variable_get('comment_' . $type, 0)) {
case 1:
$status = '<em> (comments are currently read only)</em>';
break;
case 2:
$status = '';
break;
default:
// case 0
$status = '<em> (comments are currently disabled)</em>';
break;
}
$types[$type] = $obj->name . $status;
}
$form['comment_perm_node_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Enable comment permissions by role for these content types'),
'#default_value' => variable_get('comment_perm_node_types', array()),
'#options' => $types,
);
$form['comment_perm_message_anon'] = array(
'#type' => 'textfield',
'#title' => t('Commenting denied message for anonymous users'),
'#default_value' => variable_get('comment_perm_message_anon', 'Login or register to post comments!'),
'#description' => t('Ideally commentting will be invisible to those without permission to post, but
just in case you can specify the message they will see.'),
);
$form['comment_perm_message_reg'] = array(
'#type' => 'textfield',
'#title' => t('Commenting denied message for registered users'),
'#default_value' => variable_get('comment_perm_message_reg', "We're sorry, but you can't post comments here!"),
'#description' => t('Ideally commentting will be invisible to those without permission to post, but
just in case you can specify the message they will see.'),
);
return system_settings_form($form);
}