Reputation: 544
I've a content type 'Content' with the field 'Value' (an integer) and a flag called 'Publish Content and grant points to user'. Every time a Content is flagged with this flag, I'd like to grant the Content's author some User Points, equal to the value in the 'Value' field, but with a maximum of 5.
I've got a question about the 'maximum 5' condition. I made 2 seperate rules with an extra condition 'Data comparison': one with [flagged-node:field-value is lower than 6] and another with [flagged-node:field-value is greater than 5]. (Note that I can choose "field-value" here!) Isn't it possible to do this in just 1 single rule?
Note: I also have a problem with the 'Value' field. See: Grant user User Points equal to value of certain field.
Upvotes: 0
Views: 313
Reputation: 544
I found a solution for my question; maybe it can help others too. I actually created a 'correction' Rule that's activated after a user was awarded userpoints and a 'Content' node was flagged with 'Publish Content and grant points to user'. This is how I set up the Rule:
EVENT
Then, I checked whether the amount of points is higher than 5.
CONDITIONS
[userpoints-transaction:points]
is greater than 5
Finally, I calculated the difference between the added userpoints and 5 and substracted this value from the user's userpoints.
ACTIONS
[userpoints-transaction:points]
"-" 5
(variable name: difference)[difference]
"*" -1
(variable name: substract)[userpoints-transaction:user]
substract
pointsI had to insert the second calculation, because otherwise, I couldn't substract the 'difference' from the user's userpoints.
Upvotes: 2