Hi,

I just installed the module. I made it possible for all user with role A to administrate the comments on the contents they create. Works great thanks.
However, the setting "skip comments approval" is checked by default so now Anonymous Users can post comments without requiring approval. I don't want to have to go on every user's page to uncheck the setting and for the new users that will be created I want the check box to be uncheck by default so that approval is required and the email notification is sent (great feature too by the way). Where can I modify this ? How should I do it the proper way so that it won't be erased when I update you module ?

Thank you !

Comments

Nicolas Bouteille’s picture

Just in case someone also needs this, for now what I did is completely disabled to functionality because I don't care if my users A can't let people skip comment approval. I prefer that they are forced to approve all comments than having to uncheck the checkbox for every newly created account.

Here's what I did :

function commentaccess_requires_approval($type, $owner = 0) {
  // Make sure we have a valid user object for node author
  if (is_object($owner) && $owner->uid) {
    $skip_approval_field = "commentaccess_skip_{$type}";
    /*
    if ($owner->data["$skip_approval_field"] == 1 ) {
      return FALSE;
    }
    else {
      return TRUE;  // node author enabled their approval queue
    }
    */
    return TRUE; // ADDED TO ENFORCE APPROVAL
  }
  else { // Didn't get a valid user object
    return FALSE;
  }
}

I also unchecked and disabled the checkbox for consistency :

$form['commentaccess_settings']["commentaccess_skip_$type"] = array(
  '#type' => 'checkbox',
  '#disabled' => TRUE, // ADDED TO DISABLE THE CHECKBOX
  '#title' => t("$node->name: skip comment approvals"),
  //'#default_value' => isset($account->data["commentaccess_skip_$type"]) ? $account->data["commentaccess_skip_$type"] : 0,
  '#default_value' => 0, // ADDED TO UNCHECK THE CHECKBOX
  '#description' => t('Check this to allow other people to comment on your posts without approval (Administrators may always comment without approval).'),
);

Still all these changes will be gone if I ever update the module so I also modified the version in the .info file to give me a warning I should update this module manually only.

; Information added by drupal.org packaging script on 2011-02-23
version = "7.x-1.0 /!\\ DO NOT UPDATE AUTOMATICALLY - CUSTOM MODIFICATIONS INSIDE /!\\"

But this solution is not good enough, I'd love to learn how I can do it the right way !

Thank you !

rschwab’s picture

Title: How to uncheck by default "skip comments approval" in the user's comment access settings ? » Let site admins determine defaults for "skip comments approval" in user settings
Version: 7.x-1.0 » 7.x-1.x-dev
Category: support » feature

This sounds like a good feature request.

While the existing default was chosen because its better to have core functionality be the default, this should really be up to the site admin.

rschwab’s picture

Status: Active » Closed (duplicate)

I'm silly! This was implemented in #1120216: Allow site builders to choose their own defaults

To get there go to Comment Access' configuration page at /admin/config/content/commentaccess