1

I am using the AJAX Comments module. For forum I am using the Advance Forum module. In forum topic I have some post replies, my issue is when I am click on delete button on forum comment a popup is shown with message:

You are not authorised to access this page

I have assigned the permission so any one can delete their own comment.

I don't know what is the issue because on other content type comment its working fine but only on forum comment its not working.

2
  • Works fine for me on clean drupal install with the core Forum module, with Advanced Forum, AJAX comments didn't work for me.
    – No Sssweat
    Jul 23, 2016 at 23:54
  • Hi,Sssweat same issue i forgot to mention I am also using advance forum. and with advance forum AJAX comment not work fine only on delete condation. Jul 25, 2016 at 5:44

1 Answer 1

1

There is a bug report about this

According to one of the comments written by Ravathi.M

i am also having the same issue the comment wraper class is missing.for the initial execution.then i have added the ajax-comment-wraper class by custom js code.now it is working fine

Looks like the solution is that you need to add the ajax-comment-wraper comment-wrapper-[post#] class name to your forum comments.

Go to /sites/all/modules/advanced_forum/styles/naked folder and replace the advanced-forum-naked-post.tpl.php with this code:

<?php

/**
 * @file
 * Theme implementation: Template for each forum post whether node or comment.
 *
 * All variables available in node.tpl.php and comment.tpl.php for your theme
 * are available here. In addition, Advanced Forum makes available the following
 * variables:
 *
 * - $top_post: TRUE if we are formatting the main post (ie, not a comment)
 * - $reply_link: Text link / button to reply to topic.
 * - $total_posts: Number of posts in topic (not counting first post).
 * - $new_posts: Number of new posts in topic, and link to first new.
 * - $links_array: Unformatted array of links.
 * - $account: User object of the post author.
 * - $name: User name of post author.
 * - $author_pane: Entire contents of the Author Pane template.
 */
?>

<?php if ($top_post): ?>
  <?php print $topic_header ?>
<?php endif; ?>

<div id="<?php print $post_id; ?>" class="<?php print $classes; ?> ajax-comment-wrapper comment-wrapper-<?php print str_replace('post-','',$post_id); ?>" <?php print $attributes; ?>>
  <div class="forum-post-info clearfix">
    <div class="forum-posted-on">
      <?php print $date ?>

      <?php
      // This whole section is for printing the "new" marker. With core comment
      // we just need to check a variable. With Node Comment, we need to do
      // extra work to keep the views caching used for Node Comment from
      // caching the new markers.
      ?>
      <?php if (!$top_post): ?>
        <?php if (!empty($new)): ?>
          <a id="new"><span class="new">(<?php print $new ?>)</span></a>
        <?php endif; ?>

        <?php if (!empty($first_new)): ?>
          <?php print $first_new; ?>
        <?php endif; ?>

        <?php if (!empty($new_output)): ?>
          <?php print $new_output; ?>
        <?php endif; ?>
      <?php endif; ?>
    </div>
    <?php /* End of posted on div. */ ?>

    <?php if (!empty($in_reply_to)): ?>
     <span class="forum-in-reply-to"><?php print $in_reply_to; ?></span>
    <?php endif; ?>

    <?php /* Add a note when a post is unpublished so it doesn't rely on theming. */ ?>
    <?php if (!$node->status): ?>
      <span class="unpublished-post-note"><?php print t("Unpublished post") ?></span>
    <?php endif; ?>

    <span class="forum-post-number"><?php print $permalink; ?></span>
  </div> <?php /* End of post info div. */ ?>

  <div class="forum-post-wrapper">
    <div class="forum-post-panel-sub">
      <?php if (!empty($author_pane)): ?>
        <?php print $author_pane; ?>
      <?php endif; ?>
    </div>

    <div class="forum-post-panel-main clearfix">
      <?php if (!empty($title)): ?>
        <div class="forum-post-title">
          <?php print $title ?>
        </div>
      <?php endif; ?>

      <div class="forum-post-content">
        <?php
          // @codingStandardsIgnoreStart
          // We hide the comments and links now so that we can render them later.
          hide($content['taxonomy_forums']);
          hide($content['comments']);
          hide($content['links']);
          if (!$top_post)
            hide($content['body']);
          print render($content);
          // @codingStandardsIgnoreEnd
        ?>
      </div>

      <?php if (!empty($post_edited)): ?>
        <div class="post-edited">
          <?php print $post_edited ?>
        </div>
      <?php endif; ?>

      <?php if (!empty($signature)): ?>
        <div class="author-signature">
          <?php print $signature ?>
        </div>
      <?php endif; ?>
    </div>
  </div>
  <?php /* End of post wrapper div. */ ?>

  <div class="forum-post-footer clearfix">
    <div class="forum-jump-links">
      <a href="#forum-topic-top" title="<?php print t('Jump to top of page'); ?>" class="af-button-small"><span><?php print t("Top"); ?></span></a>
    </div>

    <div class="forum-post-links">
      <?php print render($content['links']); ?>
    </div>
  </div>
  <?php /* End of footer div. */ ?>
</div>
<?php /* End of main wrapping div. */ ?>
<?php print render($content['comments']); ?>

Since the forum post and the 1st comment have the same number 1 you will notice that clicking reply will affect the node post as well. Therefore, you will need to use jQuery to modify or remove the 1 from comment-wrapper-1 of the forum (node) post.

9
  • Which Place i am add above class Jul 25, 2016 at 5:56
  • idk, check one of your content type comments, right click and inspect element with your browser and see where that class goes.
    – No Sssweat
    Jul 25, 2016 at 5:57
  • I know but in which file i write the code or give me the example of code Jul 25, 2016 at 6:11
  • @AnkitGupta it's hard to do when idk where it's suppose to go. The advanced forum module comes with a lot of template files, it probably goes inside one of them. Else, you could use custom jQuery code to insert it. Sorry, I don't have time to setup a D7 server to check this out, I hope you can figure this part out.
    – No Sssweat
    Jul 25, 2016 at 6:16
  • Thanks Sssweat for help I will try to find the place where i am written that code Jul 25, 2016 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.