I have Mollom installed on a site that protects the 'contact' and 'forgot password' forms. I don't need to protect node forms as Anonymous users (and Authenticated users for that matter) can't create nodes (and only Administrators can create user accounts). Therefore, there's no way nodes are going to be spam.

It is therefore annoying and slightly confusing for my client to see a 'Report as…' message every time he deletes a node.

I'd like to have the option to disable this reporting feature on a per content type/entity basis to allow for my situation as above.

Comments

eshta’s picture

Perhaps an approach to this would be to only add the reporting form to node delete if there are nodes that are protected (rather than comments, etc.). This attachment happens in mollom_form_alter() and it looks like there is some code in there already to guard against this... but perhaps it needs some tweaking.

// Integrate with delete confirmation forms to send feedback to Mollom.
  if (isset($forms['delete'][$form_id])) {
    // Check whether the user is allowed to report to Mollom. Limiting report
    // access is optional for forms integrating via 'delete form' and allowed by
    // default, since we assume that users being able to delete entities are
    // sufficiently trusted to also report to Mollom.
    $access = TRUE;
    // Retrieve information about the protected form; the form cache maps delete
    // confirmation forms to protected form_ids, and protected form_ids to their
    // originating modules.
    $mollom_form_id = $forms['delete'][$form_id];
    $module = $forms['protected'][$mollom_form_id];
    $form_info = mollom_form_load($mollom_form_id, $module);

    // For entities, there is only one delete confirmation form per entity type.
    // But not all of its bundles may be protected. We therefore need to figure
    // out whether the bundle of the entity being deleted is protected - which
    // is a reverse-mapping that does not exist in D7.
    $is_protected = TRUE;
    $is_entity = !empty($form_info['entity']);
    $has_entity_argument = isset($form_state['build_info']['args'][0]) && is_object($form_state['build_info']['args'][0]);
    if ($is_entity && $has_entity_argument) {
      list(, , $bundle) = entity_extract_ids($form_info['entity'], $form_state['build_info']['args'][0]);
      $is_protected = db_query_range('SELECT 1 FROM {mollom_form} WHERE entity = :entity AND bundle = :bundle', 0, 1, array(
        ':entity' => $form_info['entity'],
        ':bundle' => $bundle,
      ))->fetchField();
    }
    if (!$is_protected) {
      return;
    }
    // Check access, if there is a 'report access' permission list.
    if (isset($form_info['report access'])) {
      $access = FALSE;
      foreach ($form_info['report access'] as $permission) {
        if (user_access($permission)) {
          $access = TRUE;
          break;
        }
      }
    }
    if ($access) {
      mollom_data_delete_form_alter($form, $form_state);
      // Report before deleting. This needs to be handled here, since
      // mollom_data_delete_form_alter() is re-used for mass-operation forms.
      array_unshift($form['#submit'], 'mollom_data_delete_form_submit');
    }
eshta’s picture

Status: Active » Postponed (maintainer needs more info)

I came back to look at this again and I'm not able to reproduce your situation. I have a D7 site set up with only the site-wide contact form and the password request form protected and I'm not seeing the customized mollom report form when I delete a node. Please provide steps to reproduce and any other information that you think might be relevant.

Nick_vh’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
markdc’s picture

I have this problem as well.

markdc’s picture

Status: Closed (cannot reproduce) » Postponed (maintainer needs more info)