Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

Categories

In this Discussion

Who's Online 16

CurtisOdenericgilletteqwenty +13 guests

There are some minor bugs with this plugin*

This discussion is related to the Voting addon.
If there is a comment with 2 vote, you can click up to increase it to 3. Then click up again resets it to 0, click again, sets it to 1, again to 2, and again back to 3.

Needs improvement.
Tagged:

Comments

  • Posts: 12
    I don't have this bug. Which version of Vanilla do you use?
  • Posts: 2
    the latest beta.
  • Posts: 4

    In the class.voting.plugin.php file, replace the content around line 249-268 with this...hopefully that helps. Took me a few hours to figure it out =P:

    $CommentID = GetValue(0, $Sender->RequestArgs, 0);
          $VoteType = GetValue(1, $Sender->RequestArgs);
          $TransientKey = GetValue(2, $Sender->RequestArgs);
          $Session = Gdn::Session();
          $OriginalScore = $Object->Score;
          $FinalVote = 0;
          $Total = 0;
          if ($Session->IsValid() && $Session->ValidateTransientKey($TransientKey) && $CommentID > 0) {
             $CommentModel = new CommentModel();
             $OldUserVote = $CommentModel->GetUserScore($CommentID, $Session->UserID);
             $NewUserVote = $VoteType == 'voteup' ? 1 : -1; //if voteup then $NewUserVote = 1 else -1
             $FinalVote = intval($OldUserVote) + intval($NewUserVote);
             // Allow admins to vote unlimited.
             $AllowVote = $Session->CheckPermission('Garden.Moderation.Manage');
             // Only allow users to vote up or down by 1.
             if (!$AllowVote && ($FinalVote > -2 && $FinalVote < 2)){
                $AllowVote = true;
             }else {
                $AllowVote = false;
             }
    
             if ($AllowVote){
                $Total = $CommentModel->SetUserScore($CommentID, $Session->UserID, $FinalVote);
             }else {
                $FinalFinalVote = $OriginalScore + $OldUserVote;
                $Total = $CommentModel->SetUserScore($CommentID, $Session->UserID, $FinalFinalVote);
             }
    
  • 422422
    Posts: 2,103 1 like

    another bug is the missing loading.gif

    ♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads

Sign In or Register to comment.