Now that our rule is configured, we should test it out to make sure that it is working as expected. If we head over to my user profile, and click the “edit” tab, we’ll find the new field at the bottom of the page. If I try to save this page without entering a date, I’ll receive an error. So, let’s see if our rule works by logging out and logging back in.

Sure enough, Rules is triggered upon log in and I have been redirected to my user profile edit page. At this point, it may not be apparent to users that there is a new field that needs to be filled out. One thing you might want to do, is display a message to let users know about the new field. This can also be done in Rules. Let’s configure that message.

  • Go to “Configuration => Workflow => Rules” (admin/config/workflow/rules)
  • Click “edit” next to our rule
  • Click “Add action” (We’re going to tell rules to display a message to the user.)
  • Select the action to add: Show a message on the site
    • Value: You’ve been redirected to your profile edit page because we don’t have your birth date on file. Please enter your birth date in the field below, and you will never see this message again.
    • Message type: Status (In the Bartik theme, Status is themed to be green, Warnings are yellow, and errors are red.)
  • [x] Repeat message (If this is checked, the message will be displayed every time the rule is fired. If unchecked, the message will only be displayed to the user once. I want it to show every time until the user has filled in the field, so, I’ll leave it checked.)
  • (Save)

Let’s log out and log back in to see if the message is displayed.

Sure enough, the message is displayed at the top of the page.

Now, I’ll fill in the form, log out, and log back in to see if I am no longer redirected.

  • Birth Date: 7/11/1986
  • (Save)

Now that the field is filled out, I am going to log out and log in again to make sure that I am not redirected.

This time, I stayed on the home page, so it works!