2

I need to grant points to users for updating their user profile with licensing info about their company. Right now I have the following rule:

Event: After updating an existing user account

Add event: NOT Data value is empty
Parameter: Data to check: [site:current-user:field_licensing]

Action:Grant reputation to a user
Parameter: User: [site:current-user], Reputation: 25, Reputation category: Reputation,   
Operation: Insert, Moderate: Automatically approved

How can I stop Rules from adding points each time the user updates their profile? Since the rule checks if the field is not empty it currently awards 25 points with each update. How can I get Rules to check if the profile update added value for the field_licensing, or merely updated the profile and field_licensing has the same value?

2
  • this was 4 years ago, and it was resolved then with Chapabu's answer. But I see the merit of your answer as well! Commented Feb 6, 2018 at 17:52
  • Merci for the (late) feedback anyway. and BTW, another solution could be to use the Goals module (disclosure: I'm its maintainer ...). Not sure if you're familiar with that one. Commented Feb 6, 2018 at 17:59

2 Answers 2

1

You could put a field on the User entity called something like field_points_attributed and hide it from the authenticated users using Field Permissions.

Then set an action on your rule, so that as well as adding the user points, it also changes the value in the field to something like "yes" or "attributed".

Lastly, add a condition to check the value of that field, and ensure it doesn't say "yes" or "attributed".

1

Another solution is to use the Flag module and create a (global) flag with the purpose to flag users when they are awarded those 25 points.

Then extend your existing rule like so:

  • Add an extra Rules Action to flag the user.
  • Add an extra Rules Condition to check that the user has not been flagged (by this flag).

That's really it.

Your Answer

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

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