Theres是一个向投票api添加规则的模块:http : //drupal.org/project/voting_rules
用户点附带本机规则支持。
我只是在测试环境中设置了整个程序,并添加了新规则
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
其他信息:您必须启用userpoints和userpoints_rules以及voting_rules
这是规则的输出
{ "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"
}
}
]
}
}