How to grant user User Points after adding comment once?

I created a rule to grant users User Points when they add a comment on an Article node. However, I'd like to grant them these points only once per node: every comment added to a node after the first comment shouldn't cause the users to get points for commenting on that node.

How can I do that?

I solved my problem with the Flags module: I created the flags called 'Commented on this node' & 'First reaction'* and rule called 'Commented on a node'. These are my rule's settings:

EVENTS: After saving a new comment

CONDITIONS:
•Content is of type Parameter: Content: [comment:node], Content types: Article
•NOT Node is flagged Parameter: Flag: Commented on this node, node: [comment:node], User on whose behalf to check: [comment:author]

ACTIONS:
•Grant points to a user Parameter: User: [comment:author], Points: 2, Points category: Reaction, Entity: [comment:node], Description: New reaction, Operation: Add, Display: false, Moderate: Automatically approved
•Flag a Node Parameter: Flag: Commented on a node, Node: [comment:node], User on whose behalf to flag: [comment:author], Skip permission check: false
•Flag a Comment: Parameter: Flag: First reaction, Comment: [comment], User on whose behalf to flag: [comment:author], Skip permission check: false

So, every time a user adds a comment to a certain node for the first time, the node is flagged as 'Commented on a node', the reaction is flagged as 'First reaction' and the user who added the comment is rewarded 2 points.

*I use the 'First comment' flag in a related question.

-----------------------------------------------------------------------------

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.

I tried solving the first part of my problem with the Rules module like this:
*Event: A node has been flagged, under "Publish Content and grant points to user"

*Conditions: Content is of type 'Content'

*Actions: Grant points to a user: ...

However, it's impossible to pick flagged-node:field-value in the Points section. I also tried:
*Event: A node has been flagged, under "Publish Content and grant points to user"

*Conditions: Content is of type 'Content'

*Actions:

- Calculate a value: `[flagged-node:field-value]` "+" 0. (Variable name = result)

- Grant points to a user: ...

But then, the variable 'result' is not available. How can I solve this issue?

So every time, when user click to flag on node, in rules must add +1 to field 'Value'? – oneng Sep 21 '13 at 20:10

No, the user who added the Content has to get the same amount of User Points as the 'Value' field. Only I, as administrator, can flag content. The value in the field 'Value' doesn't change after the flagging. – Jeroen Sep 21 '13 at 21:54

You can make 5 rules, each one be have condition: 'If value is 1 = grants 1', 'If value has 2 = grants 2'... 'If value has 5 = grants 5' – oneng Sep 22 '13 at 10:40

Okay, but that seems a lot of work (imagine that I'd like to grant up to 100 points or something...). I tried 'Calculate a value': flagged-node:field-value + 0, because that's of course equal to the value in the Value field. I called this result 'Result'. Unfortunately, I can't grant the author of the flagged Content 'Result' User Points... Or can I? – Jeroen Sep 22 '13 at 10:53

0

down vote

accepted

I finally found a solution! I completed the second scenario (the amount of User Points is calculated) successfuly! Apparently, the User Points module didn't know that the calculation was an integer. Therefore, I had to add an extra action Convert data type: Target type: Integer, Value to convert: [result], Rounding behavior: Always down. I called it 'total' and granted the user this amount of User Points.