I initially had ajax comments. However, after I installed this module the comments posted correctly. However, after I refresh the original page it showed a duplicate comment. After I unable the photo module, the ajax comments started working correctly... Please help!

Also, does anyone know how to delete the database for this module? What are the tables called so I can delete them?

Thanks

Comments

iquichi’s picture

same problem here!

I've tried the 'patch' on http://drupal.org/node/455708, but no luck!

Somebody any ideas?

nathaniel’s picture

Title: Add support for ajax comments module » It interferes with ajax comments

Looking into this for the D7 version and want to leave some notes here...

Adding support for ajax comments requires #comment-wrapper:

photos.image.inc
_photos_comment ...

<?php
    // Add support for ajax comments on image page.
    $output['comments']['#prefix'] = '<div id="comment-wrapper-nid-' . $node->nid . '">';
    $output['comments']['#suffix'] = '</div>';
?>

After posting one comment the form is reloaded by ajax comments and the fid is no longer available, so the second comment and any following comments will post to the album node and appear under the image temporarily, but will not be there if the page is reloaded because the fid was not available to link that comment with the image.

Example image url:
photos/image/86

Ajax comments url:
system/ajax

Code in photos.module to add image fid to comment form:
photos_form_alter ...

<?php
    if (isset($form_state['input']['photos_fid'])) {
      $fid = $form_state['input']['photos_fid'];
    }
    elseif (arg(0) == 'photos' && is_numeric(arg(2))) {
      $fid = arg(2);
    }
    elseif (arg(1) == 'reply' && is_numeric(arg(3))) {
      $fid = db_query('SELECT fid FROM {photos_vote} WHERE cid = :cid',
        array(':cid' => arg(3)))->fetchField();
    }
    if (isset($fid)) {
      $form['comment']['photos_fid'] = array(
        '#type' => 'hidden',
        '#value' => $fid,
      );
    }
?>

So, we need some way to pass the fid (86 in this example) to the comment form after it is reloaded by the ajax comments module.

nathaniel’s picture

Title: It interferes with ajax comments » Add support for ajax comments module
Version: 6.x-2.x-dev » 7.x-3.x-dev
Category: support » feature
nathaniel’s picture

Adding the following code to the ajax_comments.module ajax_coments_submit_js function solves the problem by passing the photos_fid to the new form.

<?php
      if (isset($form_state['input']['photos_fid'])) {
        $new_form_state['input']['photos_fid'] = $form_state['input']['photos_fid'];
      }
?>

Issue on ajax comments module: #2052041: Pass custom variable to new comment form

nathaniel’s picture

Title: It interferes with ajax comments » Add support for ajax comments module
Issue summary: View changes
Status: Active » Postponed
Issue tags: -Ajax Comments Compatible
nathaniel’s picture

Status: Postponed » Closed (outdated)

Cleaning up issue queue.