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 13

CurtisOdenericgillettefh111tc74422 +8 guests

Voting Plugin: User Score

This discussion is related to the Voting addon.

Hi there, I'm currently integrating your plugin into a forum for one of our clients, one question we have is does the plugin maintain an overall score for each user? I was half expecting it to update the user's score field in the DB but it doesn't seem to. Is there a way of pulling out the user's accumulative score?

Thanks for any help you can offer.

Cheers,

K

Tagged:

Comments

  • Posts: 1,586

    We don't summarize the user score so you'd have to do that calculation yourself. We are moving away from the voting mechanic and going more with a like/reaction mechanic so we will most likely not be updating the voting plugin anymore.

    Vanilla co-founder

  • Thanks Todd, so is there a new project released? What we're effectively trying to achieve is a user "reputation". I think I may just do that calculation for now but consider revising the method long term.

  • Posts: 1,586

    We'll take pull requests if you want to add the user score. The new project needs a lot more development and testing before we release it so I can't give any timelines.

    Vanilla co-founder

  • Posts: 4

    I was going for the same functionality as well and came up with this. Hope it helps:

    //***** Get the User's Total Votes he recieved from others ******
                                    $CommentID = $Object->CommentID;
                                    $UserID = $Object->InsertUserID;
                                    $CommentModel = new CommentModel();
                                    $Data = $CommentModel->GetID($CommentID, DATASET_TYPE_ARRAY);
    
                                    //Get the score of each Users vote in comments
                                      $ScoreComment = $CommentModel->SQL
                                        ->Select('Score')
                                        ->From('Comment')
                                        ->Where('InsertUserID', $UserID)
                                        ->Get()->ResultArray();
                                      $ScoreComment = ConsolidateArrayValuesByKey($ScoreComment, 'Score');
    
                                      /*Get the score of each Users vote in discussion because the voting
                                      plugin doesn't count the main discussion as a comment*/
                                      $ScoreDiscussion = $CommentModel->SQL
                                        ->Select('Score')
                                        ->From('Discussion')
                                        ->Where('InsertUserID', $UserID)
                                        ->Get()->ResultArray();
                                      $ScoreDiscussion = ConsolidateArrayValuesByKey($ScoreDiscussion, 'Score');
                                      $TotalVoteScore = array_sum($ScoreComment) + array_sum($ScoreDiscussion);
    
                                      echo $TotalVoteScore;
    
Sign In or Register to comment.