From 80643d4c8d8b933de198f30488c3999da286cf74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bobi=CC=81k?= <bobik@ibobik.cz>
Date: Wed, 24 Oct 2012 15:19:31 +0200
Subject: [PATCH] =?UTF-8?q?Issue=201821836=20by=20Bob=C3=ADk:=20Option=20to=20?=
 =?UTF-8?q?append=20reply=20form?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ajax_comments.admin.inc | 6 ++++++
 ajax_comments.module    | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ajax_comments.admin.inc b/ajax_comments.admin.inc
index ce3f343..7e385ec 100644
--- a/ajax_comments.admin.inc
+++ b/ajax_comments.admin.inc
@@ -22,5 +22,11 @@ function ajax_comments_settings() {
     '#description' => t('Add notification message to comment when posted.'),
     '#default_value' => variable_get('ajax_comments_notify', ''),
   );
+  $form['ajax_comments_append'] = array(
+    '#title' => t('Insert reply form after all other replies'),
+    '#type' => 'checkbox',
+    '#description' => t('Reply form will be apended to the parrent comment wrapper (after all other replies) instead of put after parrent comment.'),
+    '#default_value' => variable_get('ajax_comments_append', FALSE),
+  );
   return system_settings_form($form);
 }
diff --git a/ajax_comments.module b/ajax_comments.module
index e384f45..39f2c07 100644
--- a/ajax_comments.module
+++ b/ajax_comments.module
@@ -473,7 +473,10 @@ function ajax_comments_reply($node, $pid = NULL) {
 
   // Add the new form.
   if ($pid) {
-    $commands[] = ajax_command_after('#comment-wrapper-' . $pid . '>.comment', $form);
+    if (variable_get('ajax_comments_append', FALSE))
+      $commands[] = ajax_command_append('#comment-wrapper-' . $pid . '', $form);
+    else
+      $commands[] = ajax_command_after('#comment-wrapper-' . $pid . ' >.comment', $form);
   }
   else {
     $commands[] = ajax_command_append('#comment-wrapper-nid-' . $node->nid, $form);
-- 
1.7.12.3

