HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

My Discussions counter not incremented? (2.1a)

PamelaPamela ✭✭
edited August 2012 in Feedback

with v2.1a ' My Discussions' counter is not incremented, is not?

then Sidebar 'My Discussions' link is not displayed! because there is the following condition (discussionfilter.php)

if (($CountDiscussions > 0 || $Controller->RequestMethod == 'mine') && C('Vanilla.Discussions.ShowMineTab', TRUE)) { ?> <li class="MyDiscussions<?php echo $Controller->RequestMethod == 'mine' ? ' Active' : ''; ?>"><?php echo Anchor(Sprite('SpMyDiscussions').$MyDiscussions, '/discussions/mine'); ?></li> <?php }

ok, I could remove this $CountDiscussions > 0 but in fact this is not the problem

Checked phpMyAdmin, User table, 'CountDiscussions' is always 0 (1 if I'm first administrator)

so, is it working correctly for you ?

Noticed that when I delete a discussion then 'My discussion' counter is back to its right value !

Comments

  • Sorry ;-) but it's still true since this summer :-( with a fresh install of v2.1a33 now... not for you ?

    My 'My Discussions' counter is not incremented! it's displayed '1' even if I've started more

    PS: it seems when I delete a discussion (as administrator) then my right counter is back !

  • @Pamela v2.1a33 is still on testing version. you cant expect it to have no bugs, you could submit this bug on github

  • @fr3333333x said:
    Pamela v2.1a33 is still on testing version. you cant expect it to have no bugs, you could submit this bug on github

    not said that is a bug, don't expect this alpha version to have any problem !!

  • fr3em1ndfr3em1nd ✭✭
    edited December 2012

    not said that is a bug, don't expect this alpha version to have any problem !!

    well , ok i'm not sure what you mean but it's always good to find some faults or a little glitch on something so that it'll be fixed in the future.

    for your issue you could try this:

    $Session = Gdn::Session(); $GetDiscussionsCount = $Session->User->CountDiscussions;

    $GetDiscussionsCount <== just echo this one , this should show the count of discussion for the user

  • peregrineperegrine MVP
    edited December 2012

    @fr3333333x

    I believe @Pamela is saying....

    she verified the table does not have an updated incremented count unless she deletes a discussion which seems to trigger a proper discussion count update for the particular user.

    The database table column for DiscussionCount itself is not incremented when posting a discussion.

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

  • @peregrine said:

    she verified the table does not have an updated incremented count unless she deletes a discussion which seems to trigger a proper discussion count update for the particular user.

    The database table column for DiscussionCount itself is not incremented when posting a discussion.

    yes ;-) this is what happens with my v2.1a33 and then I'm unlucky, nobody encounters this, isn't ?

    I'll try with a fresh install but for example, here, my 'mine' counter (at sidebar) displays 13 but I started 19 discussions in fact...

  • peregrineperegrine MVP
    edited December 2012

    I see the same problem on a forum on localhost

    either it is a bug, or it is related to analytics or maybe this will help

    http://vanillaforums.org/discussion/comment/171738/#Comment_171738

    I haven't pursued it. I am waiting for a rseponse from the people in the know, if it hasn't already been filed on github.

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

  • @peregrine said:
    I see the same problem on a forum on localhost

    either it is a bug, or it is related to analytics or maybe this will help

    http://vanillaforums.org/discussion/comment/171738/#Comment_171738

    I haven't pursued it. I am waiting for a rseponse from the people in the know, if it hasn't already been filed on github.

    ok, I'm not alone :) it was my main question in fact... thanks, one more time @peregrine

  • ok, I'm not alone :)

    certainly not.

    no problem - you might file this on github though if it's not there already.

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

  • image

    Same problem. Is there a fix?

  • fr3em1ndfr3em1nd ✭✭
    edited February 2013

    hi guys i got this one fixed :)

    add this to class.discussionmodel.php in folder applications\Vanilla\Models

    AROUND LINE : 1513

    //record activity

            $this->RecordActivity($Session->UserID, $DiscussionID, $DiscussionName);
    

    AROUND LINE: 1959

    //Add record Activity function to record the changes

    public function RecordActivity($UserID, $DiscussionID, $DiscussionName) {
    // Report that the discussion was created
    AddActivity(
    $UserID,
    'NewDiscussion',
    Anchor(Gdn_Format::Text($DiscussionName), 'discussion/'.$DiscussionID.'/'.Gdn_Format::Url($DiscussionName))
    );

      // Get the user's discussion count
      $Data = $this->SQL
         ->Select('DiscussionID', 'count', 'CountDiscussions')
         ->From('Discussion')
         ->Where('InsertUserID', $UserID)
         ->Get();
    
      // Save the count to the user table
      $this->SQL
         ->Update('User')
         ->Set('CountDiscussions', $Data->NumRows() > 0 ? $Data->FirstRow()->CountDiscussions : 0)
         ->Where('UserID', $UserID)
         ->Put();
    

    }

  • fr3em1ndfr3em1nd ✭✭
    edited February 2013

    damn, i dont know how to format in forums, anyway i have an attached fixed version of class.discussionmodel.php in folder applications\Vanilla\Models

  • @hydn can you try the fix ?

  • trying now. Whats the best way to test?

  • make a backup of your original file class.discussionmodel.php in folder applications\Vanilla\Models ofcourse :)

  • yea it works. Any side effects?

  • nope

Sign In or Register to comment.