A A A

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Comment count in posts is wrong
Mar 13, 2010
12:43 am
Member
Forum Posts: 98
Member Since:
Jan 28, 2010
Offline

it doesn't matter if post revisions are enabled or disabled.

If you set $blogcomments to TRUE, then first LINKED comment is counted as 2. All next comments are counted as one, so we always get comment count +1.

Maybe this is not the best solution, but atleast it works:

 

function sf_comments_number($no_comment="0 Comments", $one_comment="1 Comment", $many_comment="% Comments", $blogcomments=false)
{
    global $wp_query;

    sf_initialise_globals();

    $result = $no_comment;
    $total = 0;
    $postid = $wp_query->post->ID;
    $links = sf_blog_links_control('read', $postid);

    # If linked get the post count (-1 of course)
    if ($links && sf_can_view_forum($links->forum_id))
    {
        # link found for this post
        $total = (sf_get_posts_count_in_topic($links->topic_id) -1);
        if ($total >0) $total=$total-1;
    }

    # If to include standard blog comments add that number
    if($blogcomments)
    {
        $total = ($total + $wp_query->post->comment_count);
    }

    if($total > 0)
    {
        if($total == 1 ? $result=$one_comment : $result=str_replace('%', $total, $many_comment));
    }
    echo $result;

    return;
}

 

Mar 13, 2010
7:30 pm

SP Master
Forum Posts: 22240
Member Since:
Nov 9, 2008
Offline

I don't follow your argument and most definitely do not agree that this happens. Not on any of my tests does it happen.
However, there IS (in 4.2) a problem with the count if a forum post is awaitng approval as it gets included when it should not. Mayvbe that s where your extra one s coming from.
This is fixed in 4.2.1

Yellow Swordfish
Mar 14, 2010
1:22 am
Member
Forum Posts: 98
Member Since:
Jan 28, 2010
Offline

no, comment approval is turned off. Also Akisment plugin is disabled.

Forum Timezone: America/Chicago

Most Users Ever Online: 444

Currently Online:
57 Guest(s)

Currently Browsing this Page:
1 Guest(s)

See All Online Activity

Top Posters:

-Radio-: 1251

Lee H: 606

Luffer: 535

Conrad_Farlow: 502

jim: 478

neon: 263

ovizii: 240

Tal: 240

Member Stats:

Guest Posters: 2626

Members: 7363

Moderators: 1

Admins: 2

Forum Stats:

Groups: 5

Forums: 16

Topics: 10898

Posts: 79583

Moderators: Brandon C (162)

Administrators: Yellow Swordfish (22240), Mr Papa (23688)