This is a weird little bug - the comment count is doubled, so the first comment is marked #2, second #4 and so on - see the screenshot attached.

I checked the demo website and the comment count looks fine there. Anyway, it would be interesting to see if anyone else experiences this issue. Perhaps someone knows what could be causing it?

CommentFileSizeAuthor
adv-forum-comment-count.png25.24 KBmkrakowiak

Comments

mkrakowiak’s picture

I did a little test to see what's going on, and this should be helpful.
I replaced line 243
$linktext = '#' . (($page_number * $post_per_page) + $post_number); with this:
$linktext = 'initial post number: ' . $post_number . ' | #' . (($page_number * $post_per_page) + $post_number) . ' | page number: ' . $page_number . ' | post per page: ' . $post_per_page . ' | post number: ' . $post_number; and here's what I got:

initial post number: 4 | #4 | page number: 0 | post per page: 10 | post number: 4

initial post number: 6 | #6 | page number: 0 | post per page: 10 | post number: 6

Any ideas?

michelle’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

The post counter gets incremented in the comment pre-process, which is called from the "comment" hook in _phptemplate_variables. So my guess is something on your system is calling that twice per post. If you have devel installed, you can try putting dsm($vars['comment']->cid); right before $post_number++; and see if you get the same cid twice for every post.

Michelle

mkrakowiak’s picture

Thanks, Michelle! Thanks for directing me... Once you mentioned pre-processing, I took a look at my template.php file and found that it was indeed calling twice:

function cpj_fresh_preprocess(&$vars, $hook) {
  if (module_exists('advanced_forum')) {
    $vars = advanced_forum_addvars($hook, $vars);
  }
}

After removing the $hook variable from the first line, it works like a charm.

michelle’s picture

Status: Postponed (maintainer needs more info) » Fixed

Ah, there you go. :)

Michelle

Anonymous’s picture

Status: Fixed » Closed (fixed)

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