Help with User Registration Addon Events

Greetings,

  1. I have a form called “Admin Registration Form” which uses the User Registration Addon.
  2. The Form is embedded in a page called “Admin Registration Form Page”
  3. The purpose of this page/form is to allow current site administrators to register additional folk to handle various site activities (i.e. bloggers, social marketers, etc.)
  4. FYI: The form also uses Gravity Perks “Better User Activation” Perk

My Registration Process

The registration process is a multi-step process, which I will detail below (for this example, the Site Admin has hired a Blogger and is now providing access for the blogger to manage blogging for his site).

  1. The site admin visits the “Admin Registration Form Page” and enters the new blogger’s info (name/email addy, etc. ) and submits the embedded “Admin Registration Form”,
  2. This triggers the “User is pending activation” notification, which sends the blogger an email with an {activation_url} link to activate their account.
  3. When the blogger clicks the link and visits the {activation_url} page, it triggers the 2nd notification event: “User is activated”, which sends the blogger another email telling him/her to set a password and includes the {set_password_url}.
  4. When the user completes selecting a password, the user can then log in and no other notifications are sent to the user.

However, that is not the end of OUR registration process.

While those steps complete Gravity Forms/Perks user registration process, there is a 3rd (and final) step which we require: enabling 2-Factor authentication (using WordFence).

Therefore, we need a way to send a third notification telling the user that they have been a) activated & b) set their password and explaining c) the process for setting up 2FA.

The Problem(s)

So, while the first notification is triggered by the “User is pending activation” event and the 2nd (set password) notification is triggered by “User is activated” event, NONE of the remaining available events (“User is Registered”, “User is updated” or “User pending activation deleted”) can be used to trigger my final (2FA) email.

What I Tried

After trying to use the “User is registered” event, I realized that I don’t understand what the difference is between the “User is Registered” event and “User is Activated” event as it seemed that both events fired at nearly the same time.

So, not finding a built-in event, I’m looking at the List of Hooks Related to User Registration, where I identified 3 candidates: gform_user_updated, gform_activate_user or gform_user_registered.

But again, the problem is that I still don’t know the difference between the registered event and the activated event, so I’m not sure which (if any) of these hooks I use to trigger my own email message.

UPDATE: I also looked into the Gravity Perks Better User Activation hook: gpbua_activation_success , but again, that does not seem to be the right hook,

Any guidance is greatly appreciated.

Preston

UPDATE 2: I tested ‘gform_user_registered’ and ‘gform_activate_user’ hooks and both hooks fire before the “Set Password” email is completed.

So, it appears that once a user clicks the {activation_url}

  1. BOTH gform_user_registered and gform_activate_user are fired and…
  2. The new user is created and is present in the “All Users” Admin Screen (and not the “Pending Activation” Admin Screen).

Therefore, I realize that -although the user has not yet set a password- the user is both “Registered” and “Activated” (I still have no idea what the difference is between the two).

Questions:

  1. So what happens if, for example, the user gets hit by a bus :grimacing: and therefore never sets a password …how would we know?
  2. Is there a hook somewhere I am not aware of that triggers when the “{set_password_url}” link is clicked, or (better yet) when the set password step is completed?

Please advise,
Preston

UPDATE 3: Joshua from Gravity Support provided the following info:

At the point in which a user has clicked through to the URL provided by the merge tag {set_password_url} , WordPress itself is handling the process of the password reset. As such, since WordPress provides its own hooks for this, the add-on does not provide any additional hooks for that password reset. You can make use of the action after_password_reset in order to trigger an email to the user.

Sounds like a plan!

Wasn’t aware of that hook! Now I just have to find a way to send that 3rd email only in the case where a user is an admin and only when the admin user is completing the registration/set password process and not as part of any other general password reset.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.