Question refinement
The Userpoints Karma module is indeed not available for D7. The purpose of this module was like so (from its project page):
Userpoints Karma integrates the Vote Up/Down module with the Userpoints module to provide a node/comment rating karma system.
The module allows a voter using the vote/up down widget to add or subtract points to the author of a given node or comment, thereby awarding or punishing the author for what they wrote. The number of points is configurable by the site's admin. Also, the node types are configurable, so that is shown on nodes or comments of a certain type, and not others.
The module can notify users when they login with a total of points gained/lost due to others voting up their nodes or comments.
And this module depends on the Vote Up/Down module (which only has an alfa1 version for D7).
With all this in mind, for D7, I would recommend you to go for a combination of these alternative, and often used modules to achieve the same goal (= add (or subtract) user points when some node is voted up (or down)):
It's also the approach used in the Answers module (disclosure: I'm a co-maintainer of it), i.e. within its submodule "Answers Userpoints". If you agree, read on ...
Required Rules
To handle all variations of voting, you need 4 rules (only!), which cover these 4 cases:
- a node is upvoted.
- an upvote for a node is canceled (= no longer upvoted).
- a node is downvoted.
- a downvote for a node is canceled (= no longer downvoted).
Below are the required rules, for each of these cases (use the Rules UI to import them in your own site, after you enabled the required modules mentioned above). These rules are enhanced versions of the rules included in the 7.x-4.0-rc2 version of Answers (and are expected to be committed to its dev version also). They use a content type with machine name answers_question
(adapt this name to fit your own machine name).
Upvote a node
The rule below will grant +5 user points for an upvote (to the author of the node):
{ "rules_voteup_question" : {
"LABEL" : "voteup_question",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "answers" ],
"REQUIRES" : [ "rules", "voting_rules", "userpoints_rules" ],
"ON" : { "voting_rules_insert_node" : [] },
"IF" : [
{ "node_is_of_type" : {
"node" : [ "node" ],
"type" : { "value" : { "answers_question" : "answers_question" } }
}
},
{ "voting_rules_condition_check_vote_value" : { "vote" : [ "vote" ], "value" : "1" } }
],
"DO" : [
{ "userpoints_action_grant_points" : {
"user" : [ "node:author" ],
"points" : "5",
"tid" : "0",
"entity" : [ "" ],
"description" : "Receive upvote to [node:type-name] \u0022[node:title]\u0022",
"operation" : "QuestionUpvoteReceived",
"reference" : "By uid=[vote:uid], for [node:type-name] to q=\u003Ca href=\u0022\/node\/[node:nid]\u0022\u003E[node:title]\u003C\/a\u003E",
"display" : "1",
"moderate" : "default"
}
}
]
}
}
Cancel the upvote a node
The rule below will grant -5 (= remove +5) user points for a cancelled upvote (to the author of the node):
{ "rules_voteup_question_cancel" : {
"LABEL" : "voteup_question_cancel",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "answers" ],
"REQUIRES" : [ "rules", "voting_rules", "userpoints_rules" ],
"ON" : { "voting_rules_delete_node" : [] },
"IF" : [
{ "node_is_of_type" : {
"node" : [ "node" ],
"type" : { "value" : { "answers_question" : "answers_question" } }
}
},
{ "voting_rules_condition_check_vote_value" : { "vote" : [ "vote" ], "value" : "1" } }
],
"DO" : [
{ "userpoints_action_grant_points" : {
"user" : [ "node:author" ],
"points" : "-5",
"tid" : "0",
"entity" : [ "" ],
"description" : "Unupvote [node:type-name] \u0022[node:title]\u0022",
"operation" : "QuestionUpvoteCancelled",
"reference" : "By uid=[vote:uid], for [node:type-name] to q=\u003Ca href=\u0022\/node\/[node:nid]\u0022\u003E[node:title]\u003C\/a\u003E",
"display" : "1",
"moderate" : "default"
}
}
]
}
}
Downvote a node
The rule below will subtract -2 (grant -2) user points for a downvote (to the author of the node) ... AND also -1 user point for the voter:
{ "rules_votedown_question" : {
"LABEL" : "votedown_question",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "answers" ],
"REQUIRES" : [ "rules", "voting_rules", "userpoints_rules" ],
"ON" : { "voting_rules_insert_node" : [] },
"IF" : [
{ "node_is_of_type" : {
"node" : [ "node" ],
"type" : { "value" : { "answers_question" : "answers_question" } }
}
},
{ "voting_rules_condition_check_vote_value" : { "vote" : [ "vote" ], "value" : "-1" } }
],
"DO" : [
{ "userpoints_action_grant_points" : {
"user" : [ "node:author" ],
"points" : "-2",
"tid" : "0",
"entity" : [ "" ],
"description" : "Receive downvote to [node:type-name] \u0022[node:title]\u0022",
"operation" : "QuestionDownvoteReceived",
"reference" : "By uid=[vote:uid], for [node:type-name] to q=\u003Ca href=\u0022\/node\/[node:nid]\u0022\u003E[node:title]\u003C\/a\u003E",
"display" : "1",
"moderate" : "default"
}
},
{ "userpoints_action_grant_points" : {
"user" : [ "vote:user" ],
"points" : "-1",
"tid" : "0",
"entity" : [ "" ],
"description" : "Issue downvote to [node:type-name] \u0022[node:title]\u0022",
"operation" : "QuestionDownvoteIssued",
"reference" : "From uid=[node:author:uid], for [node:type-name] to q=\u003Ca href=\u0022\/node\/[node:nid]\u0022\u003E[node:title]\u003C\/a\u003E",
"display" : "1",
"moderate" : "default"
}
}
]
}
}
Cancel the downvote a node
The rule below will grant +2 (= remove -2) user points for a cancelled downvote (to the author of the node) ... AND also +1 user point for the voter:
{ "rules_votedown_question_cancel" : {
"LABEL" : "votedown_question_cancel",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "answers" ],
"REQUIRES" : [ "rules", "voting_rules", "userpoints_rules" ],
"ON" : { "voting_rules_delete_node" : [] },
"IF" : [
{ "node_is_of_type" : {
"node" : [ "node" ],
"type" : { "value" : { "answers_question" : "answers_question" } }
}
},
{ "voting_rules_condition_check_vote_value" : { "vote" : [ "vote" ], "value" : "-1" } }
],
"DO" : [
{ "userpoints_action_grant_points" : {
"user" : [ "node:author" ],
"points" : "2",
"tid" : "0",
"entity" : [ "" ],
"description" : "Cancel downvote to [node:type-name] \u0022[node:title]\u0022",
"operation" : "QuestionDownvoteCancelled",
"reference" : "By uid=[vote:uid], for [node:type-name] to q=\u003Ca href=\u0022\/node\/[node:nid]\u0022\u003E[node:title]\u003C\/a\u003E",
"display" : "1",
"moderate" : "default"
}
},
{ "userpoints_action_grant_points" : {
"user" : [ "vote:user" ],
"points" : "1",
"tid" : "0",
"entity" : [ "" ],
"description" : "Withdraw downvote to [node:type-name] \u0022[node:title]\u0022",
"operation" : "QuestionDownvoteWithdrawn",
"reference" : "From uid=[node:author:uid], for [node:type-name] to q=\u003Ca href=\u0022\/node\/[node:nid]\u0022\u003E[node:title]\u003C\/a\u003E",
"display" : "1",
"moderate" : "default"
}
}
]
}
}
Reporting
Even though it may not be obvious from just browsing the (4) exported rules above, note the description
, operation
and reference
used in each of the User Point transactions.
After you enabled the above rules and generated some (test) data with them (by voting on the nodes they relate to), go have a look at the typical User Points reports.
Here is an example of how it could look like:
Points Date Reason Status Actions
5 Fri, 04/01/2016 - 16:30 Receive upvote to Question ... Approved view edit
-5 Fri, 04/01/2016 - 16:29 Unupvote Question "How to i... Approved view edit
2 Mon, 03/28/2016 - 14:41 addPoints Approved view edit
-2 Mon, 03/28/2016 - 14:40 removePoints Approved view edit
10 Thu, 03/17/2016 - 13:52 Upvote Answer to "What are ... Approved view edit
5 Tue, 03/15/2016 - 11:30 Upvote Question "How to imp... Approved view edit
-5 Tue, 03/15/2016 - 11:27 Voting Corrected Approved view edit