The comment edit uses the wrong template file to preview the edited comment.

This is because the offset used in the preprocess function is wrong

  3 /**
  4  * @file
  5  * Holds the contents of a preprocess function moved into its own file
  6  * to ease memory requirements and having too much code in one file.
  7  */
  8 function _advanced_forum_preprocess_comment(&$variables) {
  9   /* Easy links to the comment and parent node */
 10   $comment = $variables['comment'];
 11   $node = node_load($comment->nid);
 12   $variables['first_post'] = $node;
 13
 14   // This is a comment, not the node.
 15   $variables['top_post'] = FALSE;
 16
 17   /* Determine the template file to use for the comment. */
 18   if (arg(1) == 'reply' || arg(1) == 'edit') {
 19     // Use the preview version
 20     advanced_forum_add_template_suggestions("post-preview", $variables);
 21   }
 22   else {
 23     // Use our combined node/comment template file
 24     advanced_forum_add_template_suggestions("post", $variables);
 25   }
 26

arg(1) == 'edit'

should be

arg(2) == 'edit'

I have a custom advanced-forum.MY-CUSTOM-STYLE.post-preview.tpl.php which was not being picked up before the change. It was picked up on reply but not edit.

After the change the custom template was picked up when I edit the comments.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

inventlogic’s picture

Status: Active » Patch (to be ported)
FileSize
869 bytes

patch file attached to correct the Arg value for the edit option

inventlogic’s picture

Status: Patch (to be ported) » Needs review
FileSize
869 bytes

patch file attached to correct the Arg value for the edit option

troky’s picture

Status: Needs review » Fixed

Committed. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.