summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-09-22 07:36:57 +0000
committerDries Buytaert <dries@buytaert.net>2009-09-22 07:36:57 +0000
commitb7affdab6bfed9cd36607e0a2415089be1e6e36e (patch)
tree94dd3b13e87a60f7b0fac8ebed7dbab4cf8d5dfb /modules/comment/comment.module
parent4deee69d6e5bb2af010e40c4c5942ef068fcda03 (diff)
downloadbrdo-b7affdab6bfed9cd36607e0a2415089be1e6e36e.tar.gz
brdo-b7affdab6bfed9cd36607e0a2415089be1e6e36e.tar.bz2
- Patch #581534 by pwolanin | sun: fix redirecting after submitting a comment on a multi-page comment thread.
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module15
1 files changed, 10 insertions, 5 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 1fb88a60a..c6516519b 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -2064,16 +2064,21 @@ function comment_form_submit($form, &$form_state) {
else {
drupal_set_message(t('Your comment has been posted.'));
}
- $redirect = array('comment/' . $comment->cid, array(), 'comment-' . $comment->cid);
+ $query = array();
+ // Find the current display page for this comment.
+ $page = comment_get_display_page($comment->cid, $node->type);
+ if ($page > 0) {
+ $query['page'] = $page;
+ }
+ // Redirect to the newly posted comment.
+ $redirect = array('node/' . $node->nid, $query, 'comment-' . $comment->cid);
}
else {
watchdog('content', 'Comment: unauthorized comment submitted or comment submitted to a closed post %subject.', array('%subject' => $comment->subject), WATCHDOG_WARNING);
drupal_set_message(t('Comment: unauthorized comment submitted or comment submitted to a closed post %subject.', array('%subject' => $comment->subject)), 'error');
- $page = comment_new_page_count($node->comment_count, 1, $node);
- $redirect = array('node/' . $node->nid, $page);
+ // Redirect the user to the node they are commenting on.
+ $redirect = 'node/' . $node->nid;
}
-
- // Redirect the user to the node they're commenting on.
unset($form_state['rebuild']);
$form_state['redirect'] = $redirect;
}