Index: comment_mover.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/comment_mover/comment_mover.module,v retrieving revision 1.22 diff -u -p -r1.22 comment_mover.module --- comment_mover.module 17 Dec 2006 20:53:51 -0000 1.22 +++ comment_mover.module 22 Dec 2006 09:48:19 -0000 @@ -80,6 +80,7 @@ function comment_mover_link($type, $obje $links['comment_mover_comment_graft'] = array( 'title' => t('graft'), 'href' => "comment/graft/{$object->nid}/{$object->cid}", + 'query' => drupal_get_destination(), ); } } @@ -87,6 +88,7 @@ function comment_mover_link($type, $obje $links['comment_mover_comment_prune'] = array( 'title' => t('prune'), 'href' => "comment/prune/{$object->nid}/{$object->cid}", + 'query' => drupal_get_destination(), ); } } @@ -100,6 +102,7 @@ function comment_mover_link($type, $obje $links['comment_mover_node_graft'] = array( 'title' => t('Graft'), 'href' => "comment/graft/{$object->nid}", + 'query' => drupal_get_destination(), ); } } @@ -503,27 +506,28 @@ function comment_mover_prune($nid, $cid if (is_numeric($cid) && is_numeric($nid)) { // Pruning a comment. $comment = comment_mover_load_comment($cid); - if (comment_mover_allows_pruning('comment', $comment)) { + if ($comment && comment_mover_allows_pruning('comment', $comment)) { $_SESSION['comment_mover']['cid'] = $cid; $_SESSION['comment_mover']['nid'] = $comment->nid; $_SESSION['comment_mover']['pid'] = $comment->pid; + drupal_set_message(t('Pruning %title.', array('%title' => $comment->subject))); drupal_goto('node/'. $nid); } } else if (is_numeric($nid)) { // Pruning a node. $node = node_load($nid); - if (comment_mover_allows_pruning('node', $node)) { + if ($node && comment_mover_allows_pruning('node', $node)) { $_SESSION['comment_mover']['cid'] = 0; $_SESSION['comment_mover']['nid'] = $nid; $_SESSION['comment_mover']['pid'] = 0; + drupal_set_message(t('Pruning %title.', array('%title' => $node->title))); drupal_goto('node/'. $nid); } } - else { - drupal_set_message(t('Unable to prune the post')); - drupal_goto(); - } + + drupal_set_message(t('Unable to prune the post.'), 'error'); + drupal_goto(); } function comment_mover_graft($nid, $cid = 0) { @@ -565,6 +569,7 @@ function confirm_comment_mover_graft_sub // Moving to the same thread $comment['comment_mover'] = COMMENT_MOVER_COMMENT_TO_COMMENT_SAME_THREAD; $new_cid = comment_mover_move($comment, $cid, $nid); + drupal_set_message(t('Grafted %title.', array('%title' => $comment['subject']))); if ($new_cid) { comment_mover_unset(); drupal_goto('node/'. $nid); @@ -582,6 +587,7 @@ function confirm_comment_mover_graft_sub $comment['comment_mover'] = COMMENT_MOVER_COMMENT_TO_COMMENT_SAME_THREAD; $new_cid = comment_mover_move($comment, $cid, $nid); } + drupal_set_message(t('Grafted %title.', array('%title' => $comment['subject']))); comment_mover_unset(); drupal_goto('node/'. $nid, NULL, 'comment-'. $new_cid); } @@ -600,21 +606,25 @@ function confirm_comment_mover_graft_sub $new_cid = comment_mover_move($comment, $cid, $nid); } } + drupal_set_message(t('Grafted %title.', array('%title' => $old_node->title))); comment_mover_unset(); drupal_goto('node/'. $nid, NULL, 'comment-'. $new_cid); } } - drupal_set_message(t('Unable to move the post')); + drupal_set_message(t('Unable to move the post.'), 'warning'); drupal_goto(); } function comment_mover_load_comment($cid) { $comment = db_fetch_object(db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.cid = %d', $cid)); - $comment = drupal_unpack($comment); - $comment->name = $comment->uid ? $comment->registered_name : $comment->name; - return $comment; + if($comment) { + $comment = drupal_unpack($comment); + $comment->name = $comment->uid ? $comment->registered_name : $comment->name; + return $comment; + } + return FALSE; } function comment_mover_cancel() {