2

I would like to apply a rule that allows existing users whose email addresses come from a certain domain to continue using their existing accounts, but to prevent the creation of future accounts from these domains.

I have configured my rule to react on the After saving a new user account event, but I'm unsure as to whether to have it react also on Before saving a user account.

Does saving here refer to only to account creation, or also to account updates such as a password change?

1

Before saving a user account will react before you make a change in the user account.

And After saving a new user account will react After you create the user account.

But if you have the 2 events once you create a new user account you will trigger first the Before saving a user account event and after the After saving a new user account event.

If you go to create or update a user account always you need to call the user_save() function. The difference is in the first param. See this question with an example:

Create a user programmatically and give they a role

  • 1
    Are you familiar with the this? Reason why I ask: the kind of questions like this one here, are not obvious to answer ... My recommendation would be "time to turn on Rules debugging ... in your own site ... to find the real answer by asking the rules module to tell you what it's doing ..." – Pierre.Vriens Aug 16 '16 at 20:35
  • @Pierre.Vriens I agree with you – Adrian Cid Almaguer Aug 17 '16 at 2:35
  • So for the Before saving a user account rule to apply, there must be an existing using account? Does it also apply to newly created accounts? – Tadhg Aug 18 '16 at 13:44
  • 1
    @Pierre.Vriens the number 28275 is my user number, when you click in the share link in the question you will see your number at the end, you can use this link yo have access to the Announcer, Booster and Publicist badges – Adrian Cid Almaguer Nov 22 '16 at 14:13
  • 1
    Aha, now that is interesting! Never knew about that, and even never understood those bizarre badges ... Merci for teaching me about it ... PS: wanna try this link ??? – Pierre.Vriens Nov 22 '16 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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