When I get form errors and I get redirected to comment/reply/%node the form is not rendered. This is also true when just visiting comment/reply/%node.

Using clean drupal 6.13 install (Garland) with only this module activated.

Any ideas?

Comments

if and a’s picture

Heh. Similar problem here and now.

I'm trying to theme the comment form. It is done but when I send some text, drupal redirect me to /comment/reply/%node
BUT there are no more comment-wrapper defined in comment-wrapper.tpl.php
AND no comment has been sent

Thanks

http://ifanda.cz

drupalftw’s picture

I don't really know the inner workings of the comment module nor why certain variables is set in comment_form_above_comments. But I have a check if we have a comment/reply request. This is proberbly not that nice but it will have to work for now, atleast for me.

original:

<?php
function comment_form_above_comments_preprocess_box(&$vars) {
  global $conf;
  if (isset($conf['comment_form_location_true'])) {
    $vars = array();
    $conf['comment_form_location_'. $conf['comment_form_location_true']] = COMMENT_FORM_ABOVE;
    unset($conf['comment_form_location_true']);
  }
}
?>

fix:

<?php
function comment_form_above_comments_preprocess_box(&$vars) {
  global $conf;
  if (isset($conf['comment_form_location_true'])) {
    if(!preg_match('`comment/reply/(.*)`', $_REQUEST['q'])) {
      $vars = array();
    }
    $conf['comment_form_location_'. $conf['comment_form_location_true']] = COMMENT_FORM_ABOVE;
    unset($conf['comment_form_location_true']);
  }
}
?>
matthew petty’s picture

The fix above is working for me. Will this be committed or is there a better way of doing it?

rapsli’s picture

this worked for me too...

rapsli’s picture

StatusFileSize
new639 bytes

here is the patch

denes.szabo’s picture

Category: bug » support
Priority: Critical » Normal
Status: Needs review » Active
StatusFileSize
new1.77 KB

I just have used this module and I found a strange thing:

I am using the better_formats module (http://drupal.org/project/better_formats). When I used it with the CMAC module the filter formats did not work.

I found: CFAC module gets the comment form twice. But the system caches the form and in the second case the better formats can not able to run (not deeply understand, but it is not matter now).

So I changed this module a little bit:
In the preprocess I not just drop the box by $vars = array() but I saved it as the whole form.

 function comment_form_above_comments_preprocess_box(&$vars) {
   global $conf;
+  global $_comment_form_above_comments_form;
+  
   if (isset($conf['comment_form_location_true'])) {
-    $vars = array();
+   if (!preg_match('`comment/reply/(.*)`', $_REQUEST['q'])) {
+      $_comment_form_above_comments_form = $vars['content'];
+      $vars = array();
+    }
+    
     $conf['comment_form_location_'. $conf['comment_form_location_true']] = COMMENT_FORM_ABOVE;
     unset($conf['comment_form_location_true']);
   }

Then in the wrapper preprocess I put the saved form into the $variables. So does not need to recreate the whole comment form and it is works with the better formats module too.

 function comment_form_above_comments_preprocess_comment_wrapper(&$variables) {
-  $variables['form'] = comment_form_box(array('nid' => $variables['node']->nid), t('Post new comment'));
+  global $_comment_form_above_comments_form;
+  
+  $variables['form'] = $_comment_form_above_comments_form;
 }

I made a patch. (My first patch...) I am inserted #2 patch in it (It had a small code typo).

jefftrnr’s picture

I'm having trouble viewing the preview from a comment/edit form. It submits fine.

jefftrnr’s picture

I added the following change to your patch - is this correct?

from

if (!preg_match('`comment/reply/(.*)`', $_REQUEST['q'])) { ...

to

if (!preg_match('`comment/reply/(.*)`', $_REQUEST['q']) && !preg_match('`comment/edit/(.*)`', $_REQUEST['q'])) { ... 
denes.szabo’s picture

It is probably correct but your solution uses two preg match. I think, we can use a simpler solution:
the pattern can be this: '`(comment/edit|comment/reply)(.*)`'

So the line can be: if (!preg_match('`(comment/edit|comment/reply)(.*)`', $_REQUEST['q'])) { ...

video izle’s picture

fax8’s picture

Category: support » bug
Priority: Normal » Critical
Status: Active » Needs review

Same issue here. Patch #5 worked great.

Setting this as a bug and as critical.

denes.szabo’s picture

Category: support » bug
Priority: Normal » Critical
Status: Active » Needs review
Issue tags: +news

Does the patch #5 work with the better formats modul? http://drupal.org/project/better_formats

If not (I think not) please see the #6 patch.

Rhino’s picture

Subscribing. Solution #2 worked for me.

bymegacom’s picture

I'm having trouble viewing the preview from a comment/edit form. It submits fine.
dizi izle

vincentcarl’s picture

Us here in scottsdale carpet cleaning trying to use the comment-wrapper.tpl.php template to wrap the comment area in a specific div. I would also have just assumed that the comment/reply page would be wrapped in this same template, but it doesn't appear to be. I need to wrap this comment/reply output in the same div. Have been struggling with what shouldn't really be happening for hours.

I do see this comment-wrapper.tpl.php being used on the actual node page where the inline comments are. Just not on the comment/reply page - it seems to be assembled differently?

Rhino’s picture

Issue tags: -news

I want a "report for spam" button. See above spam comment. The issue tags were full of strange keywords too.

Edit: (and I see now that I didn't manage to delete them all, sorry about that)

computersimple’s picture

1 - I am not sure why a module that does not work is available
2 - I am not sure why this adding comments form above comments isn't an option in drupal core install

I installed this module and it doesn't work it should just say this is on the module page (i.e. This module is not a complete fix, it only works in certain cases like if you only want the module above and only if your user clicks save and not preview) and perhaps adding beta or dev to the download listing would be helpful so that people aren't relying on it as a fully developed module.

fax8’s picture

Issue tags: +the founder of <a href=

It looks that the maintainer of this module is not working anymore on it, that's why this bug hasn't been fixed. This happens sometimes.

Anyway, there are some patches above which I used and worked.

If you want to help, you could test the above patches and report if they work or not. If you have programming experience you can ask to became this module maintainer... usually complaining in the FLOSS community doesn't work, it's better to roll up your sleeves and give your help.