diff --git a/commentaccess.admin.inc b/commentaccess.admin.inc index 768bf20..044ad63 100644 --- a/commentaccess.admin.inc +++ b/commentaccess.admin.inc @@ -11,6 +11,24 @@ */ function commentaccess_admin_settings() { $form = array(); + $form['commentaccess_defaults'] = array( + '#type' => 'fieldset', + '#title' => t('Default settings'), + ); + $form['commentaccess_defaults']['commentaccess_approval_default'] = array( + '#type' => 'radios', + '#title' => t('Require comment approval by default'), + '#options' => array(1 => t('Disabled'), 0 => t('Enabled')), + '#description' => t('This sets the default on the user account form. When disabled your node authors will skip comment approvals by default. Enabling this may lead to legitimate comments not getting published, if your node authors are not aware of this feature.'), + '#default_value' => variable_get('commentaccess_approval_default', 1), + ); + $form['commentaccess_defaults']['commentaccess_mail_default'] = array( + '#type' => 'radios', + '#title' => t('Send e-mail approval notices by default'), + '#options' => array(0 => t('Disabled'), 1 => t('Enabled')), + '#description' => t('This sets the default on the user account form. When disabled node authors must opt-in to receive an e-mail when comments need approval. Warning: Enabling this may upset users who are not aware of this setting.'), + '#default_value' => variable_get('commentaccess_mail_default', 0), + ); $form['commentaccess_text'] = array( '#type' => 'fieldset', '#title' => t('Text options'), diff --git a/commentaccess.install b/commentaccess.install index 8914b7c..80e013f 100644 --- a/commentaccess.install +++ b/commentaccess.install @@ -9,6 +9,8 @@ * Implementation of hook_uninstall(). */ function commentaccess_uninstall() { + variable_del('commentaccess_approval_default'); + variable_del('commentaccess_mail_default'); variable_del('commentaccess_approval_msg'); variable_del('commentaccess_approval_php'); variable_del('commentaccess_mail_message'); diff --git a/commentaccess.module b/commentaccess.module index 19ad146..cca32f4 100644 --- a/commentaccess.module +++ b/commentaccess.module @@ -26,7 +26,7 @@ function commentaccess_help($path, $arg) { function commentaccess_menu() { $items = array(); $items['admin/content/comment/commentaccess'] = array( - 'title' => 'Approval options', + 'title' => 'Comment access', 'page callback' => 'drupal_get_form', 'page arguments' => array('commentaccess_admin_settings'), 'file' => 'commentaccess.admin.inc', @@ -262,7 +262,7 @@ function commentaccess_form_user_profile_form_alter(&$form, &$form_state) { $form['commentaccess_settings']["commentaccess_skip_$type"] = array( '#type' => 'checkbox', '#title' => t("$node->name: skip comment approvals"), - '#default_value' => isset($account->data["commentaccess_skip_$type"]) ? $account->data["commentaccess_skip_$type"] : 1, + '#default_value' => isset($account->data["commentaccess_skip_$type"]) ? $account->data["commentaccess_skip_$type"] : variable_get('commentaccess_approval_default', 1), '#description' => t('Check this to allow other people to comment on your posts without approval (Administrators may always comment without approval).'), ); } @@ -280,7 +280,7 @@ function commentaccess_form_user_profile_form_alter(&$form, &$form_state) { $form['commentaccess_settings']['commentaccess_email'] = array( '#type' => 'checkbox', '#title' => t('Receive e-mail notifications'), - '#default_value' => isset($account->data['commentaccess_email']) ? $account->data['commentaccess_email'] : 1, + '#default_value' => isset($account->data['commentaccess_email']) ? $account->data['commentaccess_email'] : variable_get('commentaccess_mail_default', 0), '#description' => t('Check this to receive e-mail notifications when new comments need your approval.'), ); }