I am getting duplicated previewed text when previewing comments.

As an example the text editor gets the following in the comment_body

[quote=myaccount]

my comment is getting quoted twice

[/quote]

[quote=myaccount]

my comment is getting quoted twice

[/quote]

I added an not isset check on to quote_form_alter function to check if the comment_preview array isset as follows:

 if (!isset($form['comment_preview'])) {
      if (array_key_exists('#default_value', $form['comment_body'][$language][0])) {
        // Add quoted text and preserve existing content (signature etc.).
        $form['comment_body'][$language][0]['#default_value'] = $quote . $form['comment_body'][$language][0]['#default_value'];
        }
      else {
        $form['comment_body'][$language][0]['value']['#default_value'] = $quote . $form['comment_body'][$language][0]['value']['#default_value'];
        }
}

This seems to fix the problem for me and I know it is a duplicate of a previous issue on the version 6 of this module.

Also I tested the quote module on a test site and agree it does not exhibit this behavior when no other modules are installed but it is clearly an issue in a real world setup and as the patch is just an additional test if I provide the patch can this be committed?

Comments

inventlogic’s picture

Status: Active » Needs review
StatusFileSize
new1.47 KB

patch to add the comment_preview array check

Zen’s picture

Issue summary: View changes
Status: Needs review » Postponed (maintainer needs more info)

I'm afraid that I'm not seeing this duplication upon hitting the preview button in beta2. Please provide steps to replicate.

Thanks.

ivnish’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)