Because #645374: Make entity ids available to form submit handlers is committed to Drupal 7, we can remove/simplify the following code in Drupal 7:

/**
 * Implements hook_nodeapi().
 */
function mollom_nodeapi($node, $op) {
  if ($op == 'insert' && isset($GLOBALS['mollom_response']['session_id'])) {
    mollom_set_data('node-' . $node->nid, $GLOBALS['mollom_response']);
  }
}

/**
 * Implements hook_comment().
 */
function mollom_comment($comment, $op) {
  if ($op == 'insert' && isset($GLOBALS['mollom_response']['session_id'])) {
    mollom_set_data('comment-' . $comment['cid'], $GLOBALS['mollom_response']);
  }
}

Comments

dave reid’s picture

Status: Active » Postponed

Marking as postponed until we have a Drupal 7 branch.

dries’s picture

Status: Postponed » Active

Reviving as we now have a CVS HEAD branch that works on Drupal 7.

sun’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
dave reid’s picture

Wait, is this for D6 or D7? Example code is D6 code and I think our D7 node/comment hooks look about as simple as they can get...

sun’s picture

This is targeting D7. Mollom is now able to use the 'post_id' mapping in its own, generic form submit handler to invoke mollom_data_save().

dave reid’s picture

Got it. Wasn't clear at all from the original post. Yeah I see now there's not much we can do for the 6.x hooks now.

sun’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Assigned: Unassigned » sun
Status: Active » Needs review
StatusFileSize
new4.11 KB

Starting point. This test fails, which is good, because I can now implement the required changes in form processing for this functionality. :)

sun’s picture

StatusFileSize
new11.15 KB

If there's something that's funky, then this is... überfunky!

sun’s picture

Status: Needs review » Reviewed & tested by the community
sun’s picture

StatusFileSize
new11.42 KB

Final tweak: Looking at how Webform handles multi-step forms, we need to add a tiny protection to account for unforeseen form rebuilds.

sun’s picture

sun’s picture

StatusFileSize
new11.67 KB

Updated the inline comments as requested.

dries’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Reviewed & tested by the community » Needs work

Committed to CVS HEAD. Thanks!

Moving back to D7.

sun’s picture

Status: Needs work » Needs review
StatusFileSize
new12.21 KB

Straight forward-port. Untested, but should hopefully work.

sun’s picture

StatusFileSize
new12.78 KB

oh, we can actually test it with core entities now ;)

Also note that I just re-opened #645374: Make entity ids available to form submit handlers with a small patch that will allow us to also kill the hook_ENTITY_delete() hook implementations in mollom.module.

dries’s picture

#645374: Make entity ids available to form submit handlers was committed. I think we should also document this "requirement" or "interaction model" in the Mollom API documentation.

dries’s picture

Committed the patch in #15 to help make progress. ;-)

sun’s picture

Status: Needs review » Fixed

Thanks!

Since revamping the Mollom feedback options to re-use existing delete confirmation forms requires larger changes anyway, I would consider this issue as fixed then.

Status: Fixed » Closed (fixed)

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

  • Commit c9a0875 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #647860 by sun: keeping sync with DRUPAL-6--1, simplify how we...

  • Commit c9a0875 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #647860 by sun: keeping sync with DRUPAL-6--1, simplify how we...