2

I have configured Vote up/down module for voting. For every vote, content author will be awarded 5 points for up-vote, but i am facing problem for down votes! i can not understand how to minus userpoints for down-votes? Say, if a voter hit down vote then 3 point will be minus from userpoints!
Installed Modules:

  1. Vote up/down
  2. Userpoints
  3. Voting API
  4. Voting Rules
  5. Rule module...

1 Answer 1

1

As I mentioned on this answer already: I guess one of your problems is to determine wether upvote insert rule or downvote insert rule was triggered - vote up/down is storing this in two separate voting sets. (I might be wrong here, when I am good for you).

Let's say it is just one vote set and there are minus votes. you would have to adjust the positive check in the condition to a negative points check. I had my rules still in the environment so I cloned them and did those changes:

(minus points will be probably just negative grants.)

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 lower than or equal to, Data value: 0

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

Export:

{ "rules_substract_down_voter" : {
    "LABEL" : "substract down 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" : "\u003C=", "value" : "0" } }
    ],
    "DO" : [
      { "userpoints_action_grant_points" : {
          "user" : [ "vote:user" ],
          "points" : "-3",
          "tid" : "0",
          "entity" : [ "" ],
          "operation" : "Insert",
          "display" : 1,
          "moderate" : "default"
        }
      }
    ]
  }
}

So there are still some things for you to check:

  • does vote/up down use one or two rule sets?
  • if it uses two, how to determine that in rules?
  • if it's only one with negative votes than you're done.
2
  • that's give me sense :) Say i have two elements in Conditions section those Operators are is lower than 0, and another one is is greater than 0 (i.stack.imgur.com/MfZBS.png). Now my question is how to have two different Actions Elements for those two different Elements of Conditions? Thanks
    – rakibtg
    Feb 9, 2013 at 5:27
  • you have to implement two separate rules Feb 9, 2013 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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