2

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?

5
  • Does submit mean published or unpublished save. Currently there is not Rules event for published/unpublish so you will have to work around it. Commented Oct 16, 2014 at 5:05
  • submit mean After new content save .
    – Jalil Khan
    Commented Oct 16, 2014 at 5:07
  • Yo will need to do a fetch entity by property (uid) to check for previous submissions. Best in my opinion is to set a hidden integer field on user object and via rules update and check it. Commented Oct 16, 2014 at 5:10
  • setting integer field option is suitable i think. thanks for giving time :)
    – Jalil Khan
    Commented Oct 16, 2014 at 5:21
  • Thank you for the accept! Sorry it took a few years to notice your question ... Commented Jul 26, 2016 at 9:38

2 Answers 2

1

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:

Here is what it would take:

  1. Goal1 = "New user", with only 1 Task = "Save 1 node" (say with machine name = save_a_node).
  2. 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:

  1. a rule with these specs:

    • Rules Event: "After a user completed Goal1"
    • Rules Action: "Send an eMail"
  2. a rule with these specs:

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

I would use Rules and I would set up multiple roles.

  • Role 1: new user
  • Role 2: after Role 1 New User creates new content, they get their role changed to Role 2
  • Role 3: after Role 2 creates new content, they get their role changed, etc.

I would think about a different # than 5 if possible, just to start, to keep roles down. This is the easiest way to handle this without custom code. Also, having multiple roles makes it easy to target for other things, like notices or other email campaigns.

1
  • The best would be to include views in rules, and execute a view that returns the node count for the user. Rules Bonus pack has a nice solution for that. But I am sure it can be done with just rules and views. Commented Oct 16, 2014 at 5:29

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.