Index: nodecomment.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodecomment/nodecomment.module,v
retrieving revision 1.3.2.15.2.17.2.5
diff -u -r1.3.2.15.2.17.2.5 nodecomment.module
--- nodecomment.module	26 May 2009 23:26:36 -0000	1.3.2.15.2.17.2.5
+++ nodecomment.module	27 May 2009 19:13:10 -0000
@@ -37,7 +37,7 @@
  * Modify the node_type_form after comment.module is done with it, to slightly
  * muck with the results.
  */
-function nodecomment_form_node_type_form(&$form, &$form_state) {
+function nodecomment_form_node_type_form_alter(&$form, &$form_state) {
   if (isset($form['identity']['type'])) {
     $none = array('0' => '-- Drupal comments --');
     /**
@@ -274,6 +274,19 @@
       }
     }
   }
+
+  // Node delete form.
+  if ($form_id == 'node_delete_confirm' && !isset($_GET['destination'])) {
+    $node = node_load($form['nid']['#value']);
+    if (isset($node->comment_target_nid)) {
+      // Change the redirect and cancel link to the parent node page.
+      $form['destination'] = array(
+        '#type' => 'hidden',
+        '#value' => 'node/'. $node->comment_target_nid,
+      );
+      $form['actions']['cancel']['#value'] = l(t('Cancel'), 'node/'. $node->comment_target_nid);
+    }
+  }
 }
 
 /**
@@ -534,12 +547,14 @@
       $links['comment_edit'] = array(
         'title' => t('edit'),
         'href' => 'node/'. $node->cid .'/edit',
+        'query' => drupal_get_destination(),
       );
     }
     if (node_access('delete', $node)) {
       $links['comment_delete'] = array(
         'title' => t('delete'),
         'href' => 'node/'. $node->cid .'/delete',
+        'query' => drupal_get_destination(),
       );
     }
     if (node_access('create', $node)) {
