diff --git a/ajax_comments.module b/ajax_comments.module index 7e7b6f3..064c736 100644 --- a/ajax_comments.module +++ b/ajax_comments.module @@ -149,7 +149,7 @@ function ajax_comments_form_comment_form_alter(&$form, &$form_state, $form_id) { return; } //@TODO: is this still needed? Breaks in views anyways - $node = menu_get_object(); + /*$node = menu_get_object(); // there should be a better way to determine the current view mode if (is_object($node)){ foreach($node->content as $field){ @@ -160,9 +160,13 @@ function ajax_comments_form_comment_form_alter(&$form, &$form_state, $form_id) { } else { // TODO: we are not in a node context and have no clue to modify the form or not + }*/ + if (empty($form_state['storage']['ajax_comments_form_id'])) { + $id = drupal_html_id('ajax-comment-' . microtime()); + $form_state['storage']['ajax_comments_form_id'] = $id; + } else { + $id = $form_state['storage']['ajax_comments_form_id']; } - $micro = microtime(); - $id = drupal_html_id('ajax-comment-'.$micro); // not sure if we still need this $form['#attributes'] = array('id' => array($id)); $form['actions']['submit']['#ajax'] = array( @@ -295,7 +299,7 @@ function ajax_comments_submit_js($form, &$form_state) { // is dumb. ajax_comments_remove_status(); - $comment = $form_state['comment']; + $comment = comment_load($form_state['comment']->cid); $node = $form['#node']; $notify_text = variable_get('ajax_comments_notify', '') ? theme('ajax_comments_notify_text', array('comment' => $comment)) : '';