Frage

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.

War es hilfreich?

Lösung

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

  • User was awarded userpoints
  • A node has been flagged, under 'Publish Content and grant points to user'

Then, I checked whether the amount of points is higher than 5.

CONDITIONS

  • Data comparison: [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

  • Calculate a value: [userpoints-transaction:points] "-" 5 (variable name: difference)
  • Calculate a value: [difference] "*" -1 (variable name: substract)
  • Grant points to a user: grant [userpoints-transaction:user] substract points

I had to insert the second calculation, because otherwise, I couldn't substract the 'difference' from the user's userpoints.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top