Conditional Activation Pages for GPBUA

Greetings,

It is possible to store a Merge Tag value in a variable? So far not successful at it. Please advise.

Thanks.

Hi Preston. Which merge tag, and at what time are you trying to store that value? Are you using one of the Gravity Forms hooks or filters?

Greetings Chris,

Thanks for replying.

The Scenario

I have a situation wherein the client will have two types of registered users in his site.

  • Admin Users: In addition to a username & password, admin users will require 2FA in order to access the back-end of the site.
  • Regular Users: These users will NOT require 2FA.

I am using Gravity Perks’ Better User Registration Perk (GPBUA).

  • This perk provides an “Activation Success” Page which fires after the user has completed registration.
  • In the Regular User’s case, the default copy is fine as there are no more steps required).
  • In the Admin’s case, there is an additional step: Setting up 2FA. Ergo, this activation success page needs to alert the “Admin” registrant that they need to check their email as another email has been sent with instructions on how to setup 2FA (via the after_password_reset hook).

Ergo, I need to display a different Activation Success page for Admin Registrants.

  • Gravity Perks provides a hook to accomplish this called gpbua_activation_page_id and provides an example, but that example does not show any integration with the current registrants info.
  • Therefore, in order to present the correct success page, I still need a way to identify if the current registrant is an “Admin” user or a “Regular” user.

The Merge Tags

I noticed that GPBUA has a number of merge tags, and TWO of the merge tags work with information that directly relates to the current registrant (i.e. gpbua:username and gpbua:email).

  • If I could get access to THAT information, I can use it to search for the current registrant (either through the registrant forms or by searching user meta).

David Smith from Gravity Perks recommended the following:

If you want to capture the value of a merge tag in a PHP variable, you could do something like: $my_value = GFCommon::replace_variables( '{any_merge_tag}', $form, $entry );. You’d need the form and entry arrays to make it work. And just replace {any_merge_tag} with any merge tag.

…and therein lies the problem: I don’t HAVE that information.

But again, the merge tags provide enough personally identifiable info on the current registrant for me to find that info.

Hence my question: “Is it Possible to Store a Merge Tag Value in a Variable (PHP)?”

Thanks

Hi Preston. I don’t have an answer for you, but I have a question. I’m not that familiar with the Gravity Wiz perk you’re using, but I installed it, and can you tell me on which page in this screenshot do you need to know that the user is an Administrator (so you can show them the information about 2FA)?

I was able to get the user information when going to the “Redirect Page” but I am wondering if you need it there, or if you need it when going to the “User Activation Page”. Please let me know.

The top one. “Activation”.

Hi Preston. I checked in with David and he’s going to investigate and update this topic when he has some idea. Thank you.

Yep. I heard back from him as well. Will keep you posted.

Behold! Stand still and see the mighty “goatness” and wizardry of @david Smith of GravityWiz. His Fix for Conditional Activation Pages for GPBUA is a thing of beauty!

Watch the video, then check out the code.

Mad props again to @david!

Preston

2 Likes

Snoop

David is the :goat:

1 Like

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