Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

post counts for discussion and comments not being registered

AoleeAolee Hobbyist & Coder ✭✭
edited May 2011 in Vanilla 2.0 - 2.8
HI guys,

I dont know what happened but looks like new comments and new discussions are not being registered in my db.

the CountDiscussions and CountComments columns in GDN_User table are still NULL even if new user posted something.

therefore all the post count in profile and discussion page give 0 count (Post: 0)

need help badly, temporarily I'm running a daily routine to update the 2 columns.

Comments

  • Options
    AoleeAolee Hobbyist & Coder ✭✭
    well looks like it's not for all users but for some users only. don't know why their post was not registered in the column. could it be because post was done via ie9? or mobile? ill try to test and see where the bug is coming in. thanks
  • Options
    judgejjudgej
    edited May 2011
    I noticed this on my instance too, and I suspect it may be something to do with how users are registered.

    The count columns in the database allow NULL, and that is the problem. If they are not initialised to zero, then adding one to them each time a comment is made, will just leave it as NULL (NULL+1 = NULL).

    I fixed it in my instance by altering the table - I made the count fields mandatory, and set their default value to zero. It has been working happily since.

    I raised this as a bug too, quite a while ago.
  • Options
    AoleeAolee Hobbyist & Coder ✭✭
    @judgej perhaps ill do the same :) thanks a bunch judgej!
  • Options
    judgejjudgej
    edited May 2011
    Just make the columns "not null" and add a default value of "0" - MySQL will do the rest of filling in the gaps. There is no need to update any data directly (with the inherent risk of over-writing counts that are already working).
  • Options

    Apologies for bumping an old topic, but I wanted to ask before making any changes.

    Am I changing the DEFAULT from NULL to NONE or AS DEFINED ? And do I clear the checkbox for NULL?

    As always, thanks in advance for your help.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    If you choose "As defined:" you get a prompt where you can enter "0". But I do not understand why you want to do that.

  • Options

    @davidaprice What are you trying to do or fix?

    Odds are, it can be done with
    /utility/structure
    or
    /dba/counts

  • Options
    peregrineperegrine MVP
    edited October 2014

    As R_J and Bleistivt indicated following advice of discussion written in 2011 for an old version of vanilla is may be misguided and there may be a better way.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    The age of the discussion did give me pause, but it seemed to be the youngest one I could find.

    The post count for the users on our forum stays at 0. But only in discussions. If I access a profile page, the number is accurate. I'm basically looking for a fix for that.

    We're running the Pure theme if that matters in this case.

  • Options

    did you run /dba/counts

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.