8

My drupal 7 site has an user rating system for authors content, but problem is, every up-vote and down-vote do not add point's automatically in users profile. But i think, it is possible by User Points module. From Userpoints Karma module page i have learned that vote/up down module allows a voter to add or subtract points to the author of a given node or comment, thereby awarding or punishing the author for what they wrote.
So, i have configured vote/up down module successfully, here is a screenshot of a views of my website:
enter image description here
Now my question is, How to add point's automatically for votes using vote/up down module and User Points module? So, if an user vote a content then the user points for that content author will be 10 + 5 = 15! {Here 10 is previous user point for the content author and 5 is the value for every up-vote!} I can't understand that How to do it automatically? Any ideas? Thanks

6

Theres is a module to add rules to voting api: http://drupal.org/project/voting_rules

Userpoints comes with native rules support.

I just set the whole thing up on my test environment, added a new Rule with

Event: User votes on a Node

Condition: User has role(s)
Parameter: User: [vote:user], Roles: authenticated user

Condition: Check the value of the vote
Parameter: Vote: [vote], Operator: is greather than, Data value: 0

Action
Grant points to a user
Parameter: User: [vote:user], Points: 5, Points category: General, Operation: Insert, Moderate: Use the site defaul

additional info: you must enable userpoints and userpoints_rules as well as voting_rules

Here's the export of the rule

{ "rules_reward_voter" : {
    "LABEL" : "reward voter",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "voting_rules", "userpoints_rules" ],
    "ON" : [ "voting_rules_insert_node" ],
    "IF" : [
      { "user_has_role" : { "account" : [ "vote:user" ], "roles" : { "value" : { "2" : "2" } } } },
      { "voting_rules_condition_check_vote_value" : { "vote" : [ "vote" ], "operator" : "\u003E", "value" : "0" } }
    ],
    "DO" : [
      { "userpoints_action_grant_points" : {
          "user" : [ "vote:user" ],
          "points" : "5",
          "tid" : "0",
          "entity" : [ "" ],
          "operation" : "Insert",
          "display" : 1,
          "moderate" : "default"
        }
      }
    ]
  }
}
  • many thanks for the quick reply, but i am just getting stuck while configuring condition in rule? If possible, can you please describe me more about the process? – rakibtg Feb 5 '13 at 18:11
  • I did an update on this – Andre Baumeier Feb 5 '13 at 18:33
  • thankyou so much for your help, i will apply it and knock you again if i get stuck again ;) – rakibtg Feb 5 '13 at 18:40
  • i found a problem, a up-vote increase user points for the voter but not for the author! also, please do something for the down-vote (-5 point) ... i am a beginner at drupal ... by the way thanks for your help :) – rakibtg Feb 5 '13 at 18:54
  • I added the condition. updated the answer :) – Andre Baumeier Feb 5 '13 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.