Page 1 of 2

Trackback/Comments counter not reliable in bullet proof?

Posted: Mon Oct 20, 2008 12:30 pm
by blog.brockha.us
Hi.

Today I noticed a strange habit of BP from s9y 1.4 alpha: My newest article counts 0 comments and 0 trackbacks in the footer, what is wrong, it has both. All other articles show correct counters. Strange.. I also switched the two display modes for counters, but this changes nothing (related to the problem)

Any idea what might went wrong here?

You can see it at my blog at the moment: http://blog.brockha.us

Re: Trackback/Comments counter not reliable in bullet proof?

Posted: Mon Oct 20, 2008 2:41 pm
by yellowled
blog.brockha.us wrote:My newest article counts 0 comments and 0 trackbacks in the footer, what is wrong, it has both. All other articles show correct counters.
The really funny thing is that you posted a newer article in the meantime, which I posted a comment on ... and it's working there again. Weird.

So it seems to be specific to that particular article. I suppose the invalid HTML in that article might be a point to tackle the problem. There's a non-closed img tag, but I think that's coming from the ebay-plugin in the sidebar.

Another idea: You have a lot of code in that article - are the special characters in there masked? Maybe that's confusing the smarty code in BP's entries.tpl (which would happen with any template).

YL

Posted: Mon Oct 20, 2008 2:48 pm
by blog.brockha.us
Hmm.. One thing that differs this problem article from the others: I deleted some test comments by me on that article.. Perhaps, there is a problem in the s9y core when doing this? I don't think the HTML should interfere the smarty processing, don't you think so, too?

P.S.: uhm.. And what HTML problem did you find? The ebay plugin produces valid HTML as far as I can see..

Posted: Mon Oct 20, 2008 2:53 pm
by yellowled
blog.brockha.us wrote:I don't think the HTML should interfere the smarty processing, don't you think so, too?
Well, I have seen a lot of things which should not have happened, but did, so ... :wink:

If so, it's more likely the Smarty code in that particular post (first and second blockquote) is the source of error. Try removing those two blockquotes from the article or masking the {/if} statements in there.

Can't say much about the deleted comments ... I think it shouldn't be a problem, but actually, that's a question for Garvin :-)

YL

Posted: Mon Oct 20, 2008 3:01 pm
by garvinhicking
Hi!

Check the serendipity_entries.comments column. It seems to hold "0" for you.

Usually this number is incremented and decremented by s9y when you delete comments. The counter would only be off, if you use SQL to delete comments or anything other than the official s9y methods.

Also, numbers might get off when unapproved comments are deleted. Unapproved comments only add to the counter once they are approved...

Regards,
Garvin

Posted: Mon Oct 20, 2008 3:02 pm
by blog.brockha.us
hmm.. well, but the smarty code is only shown in the extended article view. So while watching the article list, it can't interfere. And the article code is not part of the smarty code / template..

I deleted the whole extended article and tested. The problem still remains. That was not the reason..

Posted: Mon Oct 20, 2008 3:07 pm
by blog.brockha.us
@Garvin: The columns are set to 0!
I only used the normal s9y functionality to write and delete the comments. And btw: I never deleted a trackback.

So there seems to be a problem in 1.4 alpha with the comment delete function..

Btw: Today a new trackback came in on that article. It didn't increase the trackback counter, too.. This happened a lot after I wrote and deleted the test comments..

The problem article: http://blog.brockha.us/index.php?/archi ... pdate.html

P.S.: This article has a very strange trackback from Robert, too. Perhaps this is producing the problems?

Posted: Mon Oct 20, 2008 3:16 pm
by garvinhicking
Hi!

Slady I currently don't have the time to check this.

The counter increasion is here:

include/functions_comments.inc.php, function serendipity_approveComment():

Code: Select all

  if ($moderate) {
        $query = "UPDATE {$serendipity['dbPrefix']}entries SET $field=$field-1, last_modified=". $lm ." WHERE id='". (int)$entry_id ."'";
    } else {
        $query = "UPDATE {$serendipity['dbPrefix']}entries SET $field=$field+1, last_modified=". $lm ." WHERE id='". (int)$entry_id ."'";
    }
serendipity_approveComment should be called from all instances where comments are added (or they wouldn't also be approved).

Regards,
Garvin

Posted: Mon Oct 20, 2008 3:20 pm
by blog.brockha.us
hmm.. perhaps this code should recount the comments/trackbacks always? Is this a matter of performance, it doesn't?

Posted: Mon Oct 20, 2008 4:06 pm
by garvinhicking
Hi!

Well, I guess the code could be reworked to count all comments and trackbacks and setup the counters with those values, yes. :)

The performance impact should be okay, since only the comments for the specific entry would be fetched.

Regards,
Garvin

Posted: Mon Oct 20, 2008 4:37 pm
by Don Chambers
I cannot reproduce this error on my 1.4 sandbox..... any luck resolving it yet Grischa?

And the German to English translator was not too helpful for that entry... what exactly is the new functionality, something about "opt-in"? Also looks like new smarty variables have been added so success or failure messages can be styled differently? We could definitely add those classes into the BP colorsets.

Posted: Tue Oct 21, 2008 11:03 am
by blog.brockha.us
No, I didn't had time to look into the code yet. And it's getting worse: Now another article shows 0 comments and 1 trackback, after the 21. trackback came in on that article. It has something about 11 comments and 21 trackbacks.

It seems, that incoming trackbacks are clearing the counters *sometimes*: The first 20 trackbacks came in without a problem (some of them where done with my new 1.4 installation), but the 21st cleared the stats..

EDIT: I corrected the counters now changing the db fields, so now everything looks fine again for the moment..

@Don: In Germany we have a law saying that newsletter registrations has to be validated using a "double opt-in" or "confrmed opt-in". This means: If you register to a newsletter, the newsletter first has to send you an email with an affirmation link. Only if you click this link, you should get news. The "Subscribe to comments" functionality is seen as a newsletter, too. So s9y is missing an affirmation at that point.

And yes, I added some new smarty variables I would like to see included into the BP template, so I don't have to patch my changes on every update. How they are called and how they should be used is shown in my article http://blog.brockha.us/index.php?/archi ... pdate.html, you already saw I guess..

Posted: Tue Oct 21, 2008 4:11 pm
by Don Chambers
Thanks for the explanation Grischa - makes perfect sense since, for instance, I could subscribe to comments, but enter YOUR email address and force you to receive unwanted emails without this confirmed opt-in.

Any idea what the content message says for both success and error? If we can use the simple words "error" and "success" as headings to those messages, this might be a cool revision on your change to content.tpl:

Code: Select all

{elseif $subscribe_confirm_error}
    <div class="serendipity_Entry_Date">
        <h3 class="serendipity_date">{$CONST.ERROR}</h3>
        <div class="serendipity_content_message comment_subscribe_error">{$content_message}</div>
    </div>
{elseif $subscribe_confirm_success}
    <div class="serendipity_Entry_Date">
        <h3 class="serendipity_date">{$CONST.SUCCESS}</h3>
        <div class="serendipity_content_message comment_subscribe_success">{$content_message}</div>
    </div>
{else}
   <div class="serendipity_content_message">{$content_message}</div>
{/if}
But until I can see what those error and success messages are, I don't want to commit this change with the extra Entry_Date div and <h3>.

Posted: Wed Oct 22, 2008 2:27 am
by blog.brockha.us
No Problem, Don.

The messages are part of the s9y language file. So perhaps you could take a look into them from the 1.4 nightly release, you'll find them at the bottom.

I will try out your suggestions tomorrow.

Posted: Fri Nov 14, 2008 8:13 am
by konus
Today I also had a problem with internal trackbacks. I use the v.1.4-beta1 with bulletproof. The trackback from a newer Article is not counted.
The url with the problem is here:
http://www.dd4kids.de/archives/124-Bike ... esden.html