October 17, 2020: Added support for Gravity Forms User Registration 4.6.
September 30, 2020: Migrated snippet to the Snippet Library.
January 7, 2020: Fixed noticed generated by use of
create_function()
.October 18th, 2013: Updated custom_maybe_activate_user() function to not rely on rgget() function.
Stop! There's a better way.
This snippet is available as a plugin with Gravity Perks, a suite of over 46 premium Gravity Forms plugins!
If you’ve checked out the latest beta for the Gravity Forms User Registration add-on, you might have noticed one of the awesome new features is “Pending Activations”. Here’s how they work.
When the user signs up, instead of automatically being registered as a user on your WordPress site, an activation email is sent to the email address they signed up with. The activation email contains an activation link. When the user clicks this link and visits the activation page, they are “activated” and their user account is registered.
One of the first things you’re probably going to want to do with this new feature is customize the activation page. This is the page where users land after clicking the activation link in the activation email. This walk-through aims to demonstrate how this activation page can be completely customized.
This process can be broken down into two simple steps:
1. Create a Custom activate.php Template
At the most basic level, all you need to do here is find the activate.php file in the GF User Registration plugin folder and place a copy of this file in your theme folder.
- Path to GF User Registration activate.php file
/wp-content/plugins/gravityformsuserregistration/includes/activate.php - Sample path to your theme folder
/wp-content/themes/ /
The issue with this is that the activate.php template really isn’t easy to customize. There are a lot of nested conditionals and special variables that you probably won’t understand without really digging in.
GW Activate Template
To alleviate some of this burden, I’ve created a special version of the activate.php which you can download and include in your theme which is much simpler to customize. The primary benefit is that it takes 99% of the HTML output that lives in the activate.php template and moves it out to easy-to-edit template parts.
GW Activate Template on GitHub
Just click the “zip” button to download all the template files. Once downloaded, unzip the gfur-activate-template-master.zip file. Inside you will find a gfur-activate-template-master folder. Rename this to “gfur-activate-template” and move this folder into your theme folder.

The Different Views of Activation
There are several different “views” or “parts” of the activation page.
2. Overriding the Default Activation Template
With the template files in place, you’re ready to override the default activate template files to point to your custom files. Doing this is actually pretty simple. Just add this code to your theme’s functions.php file:
/**
* Gravity Forms Custom Activation Template
* https://gravitywiz.com/customizing-gravity-forms-user-registration-activation-page
*/
add_action( 'wp', 'custom_maybe_activate_user', 9 );
function custom_maybe_activate_user() {
$template_path = STYLESHEETPATH . '/gfur-activate-template/activate.php';
$is_activate_page = isset( $_GET['page'] ) && $_GET['page'] === 'gf_activation';
$is_activate_page = $is_activate_page || isset( $_GET['gfur_activation'] ); // WP 5.5 Compatibility
if ( ! file_exists( $template_path ) || ! $is_activate_page ) {
return;
}
require_once( $template_path );
exit();
}
In plain speak, this code says: “Here is a path to the template file I’d like to use for my activation page. If this file exists and we’re on the GF User Registration activation page, go ahead and load my custom activation page file.”
If you’re using the GW Activate Template files and followed the instructions above, you won’t need to change this snippet at all. It’ll just work. Otherwise, you will need to change the $template_path
variable to point to the location of your own custom activate.php file.
Is it possible to customize the activation email sent to the user?
Yup! We’ve written a tutorial with step-by-step instructions on how you can customize the user activation email. Check it out.
Anything else?
That’s it for now. Give it a go and let me know how it works out of you. I’m eager for any feedback you have!
Did this resource help you do something awesome with Gravity Forms?
Then you'll absolutely love Gravity Perks; a suite of 46+ essential add-ons for Gravity Forms with support you can count on.
Thanks for this.
Am I correct in understanding that: $template_path = STYLESHEETPATH . ‘/gfur-activate-template/activate.php’; looks for the revised pages in the currently active theme directory rather than in the /themes/ directory?
If so you need to remember for all time, to move the gfur-activate-template every time you change themes.
Is there an easy way to put the gfur-activate-template folder somewhere that isn’t theme dependent? I tried: $template_path = ‘***/gfur-activate-template/activate.php’; where *** is the path to my /wp-content/themes/ but for some reason it kept using the version of the gfur-activate-template folder.
Hi Martin,
We have an easier way to do this using our GP Beter User Activation Perk and we recommend using that Perk. Snippet customization is only available to users with a Pro License, so if you have an active License you can get in touch with us via our support form.
Best,
Hello,
The activate.php in ‘/wp-content/plugins/gravityformsuserregistration/includes/activate.php’ seems to be utilized instead of the views in the theme folder ‘gfur-activate-template’ (activate-success.php, activate-no-key.php and activate-error.php), these files make no difference when edited.
Can you please check it? Thank you in advance.
Hi Omri,
I just tried it and it works as expected. Can you confirm if you’ve added the PHP code to override the default activation template? Also, check to see if the
gfur-activate-template
folder name is correct. However, if it’s still not working for you, you can get in touch with us via our support form if you have an active Gravity Forms license so we can dig into this further.Best,
Well, it did not work for me. I am using WPBakery and it breaks the rest of the page, now the shortcodes are showing.
https://www.screencast.com/t/qIW25NEJOWj
Hi Erika,
In other to be sure what’s happening, we’ll have to take a look at your setup. If you’re a Gravity Perks subscriber, you can get in touch with us via our support form so we can dig into this further.
That said, we have a better way of customizing the activation page using our GP Better User Activation Perk, so you may also want to check that out. Once activated you can use the [gpbua] merge tag to insert the user activation content anywhere in your page layout.
Best,
Im disappointed, nothing work. I add the code in functions child and main theme, add the folder, changed the name, modify the path. Nothing work for me. Does someone can tell me that it works in 2021?
Hi Ruben,
The snippet should work. That being said, we have a Perk that superseded the snippet functionality: https://gravitywiz.com/documentation/gravity-forms-better-user-activation/.
If you have an active Gravity Perks License, you can get in touch with us via our support form with your account email address and weโll be happy to dig into this further.
Best,
Hello
How can I hide the register form for logged users ? I make form by your addon.
Regards Hossein Mohammadi
Hi Hossein,
We have a snippet you can use to skip user registration for logged in users. Another solution will be to use a role based plugin to hide the page with the register form from Logged in users.
Best,
Thank you – a work in progress, but intelliphense spots this:
https://pasteboard.co/JyZHOaI.jpg
Undefined constant ‘file‘
Hello RB, Thank you for that information. When you apply this to your site and run it live, do you get this error? Let us know. ๐
Why not combine this plugin with GF Better User Activation so that users can use Elementor or WPBakery with the addon?
Hey Henry, this is a great question. We currently are just addons for Gravity Forms so we could not combine the two to make one. The Perk we have within Gravity Wiz is created to solve that issue. As Scott previously mentioned Visual page builders are supported in GF Better User Activation using the [gpbua] shortcode. Is there something that you are looking for that is not resolved within these solutions? Let us know and we would be happy to help!
Great thanks for this. I installed and seems to work. But I am using Elementor for all my page themes. How can I put what you did into my normal Elementor page template?
Hi Henry,
Visual page builders are supported in GF Better User Activation using the
[gpbua]
shortcode.Hi Maybe this is more a fuature request?
I HAVE to manually activate a new user. So I would ask if this auto activation could look “human” maybe with more than one “Office hour” random minutes activation delay?
Hope that can be done?
Peter
Hi Peter,
I’m not sure I understand your request very well, but you could send Users an activation link to activate their account. Also, Gravity Forms User Registration Add-on is what actually handles the user activations, so you may want to contact Gravity Forms Support with the Feature Request.
Best,
Hi Samuel, Thx – I sent it to Gravity … Lets see if they can make it.
Best,
It seems to work, but all styles are missing. Did I do something wrong?
Hi Mike,
Do you already have the snippet inserted inside your theme’s function.php file? Please note that template files are supposed to use the theme’s styles and it’s just a starting point for you in case you want to do advanced customization.
In case the issue you’re experiencing is with the Theme’s styles not displaying at all, then we’ll have to take a closer look to determine what may be wrong. If you have a Gravity Perks License, you can send us a message via our support form so we can dig into this.
Best,
Hi, thanks for all the assistance. I have another question. Some people receive an error message when they want to activate their account: “activation was not successful due to following error: invalid activation key”
Can I activate it manually? Or what should they do to correct that error and activate their account?
Hi Paul,
There have been known issues where using BuddyPress conflicts with Better User Activation which generates a similar error. In case you have BuddyPress, unset the “Activation” page in BuddyPress Settings. Also, you can manually activate a user account within the Form entry page.
Best,
Hi, Is it possible that users do not have to activate their account with the link? Is there an option for them to directly use their account once they have uploaded their username and password?
Hi Paul,
Sure. Don’t enable user activation in the User Registration feed, and then use Auto Login to automatically log them in after registering.
FYI: The latest update of the User Registration Add-on uses a new activation link โ domain.ext/?gfur_activation=XXX โ as explained in the change log: “Updated the activation page query string to use the “gfur_activation” parameter instead of “page” to fix an issue with WordPress 5.5 where a 404 not found error occurs. Existing activation links will automatically redirect to the new page.”
As a result, the code above no longer works, altdough it’s rather straightforward how to change it to work with the new queryvar.
Hello Joachim, Thank you for bringing this up. I will forward this to my team and we will update this with the necessary steps moving forward. Have a wonderful day.
I am also facing same issue, please suggest a solution for the same.
Hi Jyoti,
This issue has been resolved in the updated version of the snippet. You can get the updated version of the snippet from the Snippet Library.
Best,
Hello – this is a great tutorial – thank you!
I am having an issue whereby the new template (wheter extended or simple) does not use the theme css of the rest of the site. That is, the header and footer and body have no styling.
Any tips on why that may be happening?
This is my site:
https://course.sustainabilityteachers.org/
Hello Carla, This is a bit of a strange one. I have attempted to test your page but cannot recreate this issue as I see the same header, footer, and body with the correct CSS. You will notice that I have gone through the registration process as well. Is their something specific I should be doing to recreate this issue or is it possibly a cache issue? Let us know.๐