How to use Rules to send an email after a user submits a first node and grant a new role after 5 nodes? I want to send a congratulations email to user on submitting his/her first node.

I want to implement this through the Rules module. But I am confused and think that there is no such option except PHP evaluation which seems bad to me due to eval().

And I also want to assign a special role to a user after a user submitted (= Save new content) 5 nodes.

Any suggestions?
This can be implemented perfectly by using the Goals module (disclosure: I'm its maintainer), as further detailed below.

Part 1 - Configure 2 goals

You'd start by configuring the appropriate set of Goals and related Tasks. For a basic introduction about Goals, have a look at:


How to implement gamification in a Drupal site and award incentives?
Its video tutorial.


Here is what it would take:


Goal1 = "New user", with only 1 Task = "Save 1 node" (say with machine name = save_a_node).
Goal2 = "Mature user", with Task = "Save 5 nodes".


Part 2 - Create a rule to record progress on the tasks

Create a rule using Rules Event "After saving new content". The purpose of this rule is to make Goals automatically track the progress on completing the tasks (which you can do via an appropriate Rules Action to record that progress).

The interesting part of this is that you can reuse the same rule (related to that machine name = save_a_node) to keep track of the progress of any user to become a New/Mature customer (check the video for a similar sample).

Part 3 - Trigger your rules after a goal is achieved

Together with what is above, you should write these 2 rules to implement what your question is actually about:


a rule with these specs:


Rules Event: "After a user completed Goal1"
Rules Action: "Send an eMail"

a rule with these specs:


Rules Event: "After a user completed Goal2".
Rules Action: "Assign role to user".