I update my mollom module from 1.6 to 2.1 well 2.x to be more clear. When I try to report and delete a comment it's never get deleted the path is like Ex. mollom/report/node/199?destination=node/199 the function callback is mollom_report_form(). This function report and delete the entity.

I start to looking the code and I see some missing callback and other function that I don't understand.

The old mollom (1.6) had declare this lines.

<?php
/**
* @name mollom_node Node module integration for Mollom.
* @{
*/
/**
* Implements hook_mollom_form_list().
*/
function node_mollom_form_list() {
 
$forms = array();
  foreach (
node_get_types('types') as $type) {
   
$form_id = $type->type . '_node_form';
   
$forms[$form_id] = array(
     
'title' => t('@name form', array('@name' => $type->name)),
     
'entity' => 'node',
     
'report access callback' => 'node_mollom_report_access',
     
'report delete callback' => 'node_mollom_report_delete',
    );
  }
  return
$forms;
}
?>

The new branch (2.x) change those lines for this.

<?php
/**
* @name mollom_node Node module integration for Mollom.
* @{
*/
/**
* Implements hook_mollom_form_list().
*/
function node_mollom_form_list() {
 
$forms = array();
  foreach (
node_get_types('types') as $type) {
   
$form_id = $type->type . '_node_form';
   
$forms[$form_id] = array(
     
'title' => t('@name form', array('@name' => $type->name)),
     
'entity' => 'node',
     
'delete form' => 'node_delete_confirm',
     
'delete form file' => array(
       
'name' => 'node.pages',
      ),
     
'report access' => array('administer nodes'),
    );
  }
  return
$forms;
}
?>

The hook_menu() declare the item with:

<?php
  $items
['mollom/report/%/%'] = array(
   
'title' => 'Report to Mollom',
   
'page callback' => 'drupal_get_form',
   
'page arguments' => array('mollom_report_form', 2, 3),
   
'access callback' => 'mollom_report_access',
   
'access arguments' => array(2, 3),
   
'file' => 'mollom.pages.inc',
   
'type' => MENU_CALLBACK,
  );
?>

And in that function you're looking for a $info['report delete callback'] as you can see this function is missing. So we never delete the comment/node/entity.

But well I still don't understand why we have to do all this nesting function to call a function like this.

<?php
/**
* Mollom report delete callback; Deletes a node.
*/
function node_mollom_report_delete($entity, $id) {
 
node_delete($id);
}
?>

The function don't use the $entity field at all. Why we have to call this nesting function only for call node_delete? This function can't be just this.

<?php
/**
* Form submit handler for mollom_report_form().
*/
function mollom_report_form_submit($form, &$form_state) {
  if (
$form_state['values']['confirm']) {
   
$entity = $form_state['values']['entity'];
   
$id = $form_state['values']['id'];
   
// Load the Mollom session data.
   
$data = mollom_data_load($entity, $id);
   
// Send feedback to Mollom, if we have session data.
   
if ((!empty($data->contentId) || !empty($data->captchaId)) && !empty($form_state['values']['mollom']['feedback'])) {
      if (
_mollom_send_feedback($data, $form_state['values']['mollom']['feedback'])) {
       
drupal_set_message(t('The content was successfully reported as inappropriate.'));
      }
    }
   
// The directly function without nesting thing.
   
node_delete($id);
  }
}
?>

Maybe it's a good reason to don't do this for D7 but for D6 I guess it's ok with this.

Comments

Status:Active» Fixed

Sorry for the very belated reply.

The Mollom module aims to integrate with arbitrary Drupal forms and entities. That's why we've standardized the integration for all forms to provide the entity type and the entity ID that a form + post belongs to.

The 'report delete callback' integration options are essentially discontinued already. Instead of providing a separate and independent "Report to Mollom" page, the 2.x series integrates with the respective delete confirmation forms of each entity instead. This allowed us to improve security and also simplify the code.

If you haven't already, I'd strongly recommend to update to the latest stable release.

Thanks for your feedback!
sun

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.