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 47 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 47+ essential add-ons for Gravity Forms with support you can count on.
How can I edit the html…I want to remove wplogin line from it.I have downloaded the activation code but there is no line such that.
Hello Faizan, This is a built-in WordPress function. Do you have a custom login page that you have set up? If so then you can alter the email to include the custom login page/activation page url instead of the supplied URL.
Fantastic site. Plenty of useful info here. I’m sending it to a few buddies ans also sharing in delicious. And naturally, thanks for your sweat!
This was GREAT! Thanks!
HI,
I have error with php 7.2 :
Deprecated: Function create_function() is deprecated in /www/test.com/wp-content/themes/test/gfur-activate-template/activate.php on line 40
here is this line of code:
Any chance for fix ?
Fixed. Updated version above. 🙂
I tried the code but I get an error “There has been a critical error on your website.” whenever I save the code to the end of the functions.php file.
Any Ideas?
Hi andys, this might help: https://gravitywiz.com/documentation/snippet-troubleshooting/
Hi! I am assuming the code above no longer works? And we should just be encouraged to purchase the plugin? That is what I am gathering from this since everyone including myself is not getting the above steps to work for the activation page. This is really ugly: https://prnt.sc/pmu2z7
Any other suggestions?
Hi Justin, this template simply provides a way for you to customize the activation page. If your theme doesn’t load its required styles and markup via the
wp_head
andwp_footer
actions, the results won’t be very attractive. The good news is that this template is completely customizable so you can modify it to make it as attractive as you want.But, yes, the plugin is a great alternative if you want something that “just works” and requires no coding.
Hi
I followed the instructions for gfur-activate-template and then edited both the activate-error.php and activate-success.php file but it doesn’t seem to ue the changes I’ve made – instead it seems to ignore the edits I’ve done to those two files and displays the default message.
Can you advise please?
Hi Ryan, if you change any template are you seeing your changes? If not, the template is probably not being included correctly. That’s a good place to start debugging.
Hi David
Yeah, I downloaded the files from Github, dropped the extracted files into the correct place and renamed the folder as described above and activated it.
The plugin is working, as its changed the pages from the default one, so thats good.
But when I modify the template files it doesn’t work :(
Is there anything I else I needed to configure after downloading and activating?
Nope. That’s should be it… If you’re a Gravity Perks user we’re happy to dig in via support but if you are a GP user, I’d recommend just using the plugin version:
https://gravitywiz.com/documentation/gravity-forms-better-user-activation/
Cheers. Will give those a try. TBH you guys are the mutts nutts when it comes to handy gravity form additions – happy to join for the value you provide straight up.
Will have a look at it again and let you know :)
We’d love to have you as a customer!
PS – “mutts nutts” ?
How is the password stored in order to be output in plain text on the activation page?
This seems like a major security flaw. I would never trust I site that displays a password in plain text in any format.
Hi Ryan, Gravity Forms support can tell you more about how the password is stored. This snippet/tutorial does not handle storing the password.
Thanks for this! The one weird thing I can’t seem to resolve is this: the actiation page behaves as if it’s the wordpress front page. So my site has a chunk of code in the header to display a banner with different content if is_front_page() evaluates to true. It also grabs some custom fields from the current page. What’s happening is that on the activation page, is_front_page() is true and the get_field() calls return content applied to my site’s static front page. I’d ideally like it to not do this, is there any obvious solution?
I could see how this would happen. I would recommend updating your conditional to account for this scenario. You can see from the snippet in this article how it checks if the user is on the activation page (see
$is_activate_page
).Alternately, check out the plugin version of this functionality which loads an actual WordPress page: https://gravitywiz.com/documentation/gravity-forms-better-user-activation/
Thanks for this Tutorial, but I’m wondering how this Activation page is generated or what theme template is being used. Is it the page.php or index.php or something else?
I’ve created a Default Page using Elementor Pro’s Theme Builder which applies to the Entire Site but this Activation page is NOT injected into that template. It reverts to the base theme template file.
Any ideas on how to integrate better with Theme templates?
Hi Dan, this snippet loads activate.php which handles loading the theme header and footer.
The plugin version of this will allow you to use a page though I’m not sure how well it would integrate with a page builder (if that’s what Elementor Pro provides).
We followed the instructions but how do we make the new page ? Any other settings to be changed?
Hi Ana, this is a template based solution where you would make changes in the PHP. If you want to handle this with a visual editor, we recommend the plugin version: https://gravitywiz.com/documentation/gravity-forms-better-user-activation/
please let me know how i can change the login link?
I’ve been playing with this just now, and downloaded the source code for the files from the git page, was ready to pull my hair out with it not working, going through the PHP, decided to echo out each variable, everything was looking right, and as expected – what wasn’t right was when downloading the files from git, it adds -master to the end of the folder name. Looking over comments others have had when they’ve not had this working, it maybe an issue they’re facing also.
Hi Geoff, renaming the unzipped folder covered in the tutorial but I’m confident your comment will be useful to other folks who miss that step as well. ?
I’m not seeing this work for me.
I uploaded the directory to my theme and added the code to the functions.php file, but it’s still loading the default activate messaging text.
I ran through the snippet troubleshooting, but it appears I’ve done everything properly. Any pointers on what to look for?
Hi,
I have a private site (users already logged in with no wp-admin access) where I have Gravity From user registration set up so they can register students using a form.
I set up a notification where is sends the {activation_url} to their personal email to activate the new user. The problem is that activation urls only work for users that are logged out of the site.
How can I get {activation_url} to work while a user is logged in?
Hi Justin, I’m not aware of a such a limitation with the activation URL; however, this is a question best directed to Gravity Forms support who actually provide this merge tag. :)
Thanks so much for the code! It works great. The only problem I’m having is when the activation page loads, it is not including my child theme css file. I can’t seem to fiqure out how to fix this. Do you have any suggestions?
Most themes will automatically work with this but in cases where your theme does not, you can manually include your theme’s CSS manually in the activate.php template() method.
I couldnt’ get it to work… I tried everything.. I used your custom template. I tried… adding the the gfur-activate-template folder to my theme “applay/” to my theme root “themes/” I added your code snippet to my “applay/functions.php” file and nothing worked…
This might help:
https://gravitywiz.com/documentation/snippet-troubleshooting/
If not, pick up a copy of Gravity Forms Better User Activation.
Hello there
after following all the steps and moving the template folder to my theme folder and paste the code into my function.php, I’m getting this error ” is currently unable to handle this request. HTTP ERROR 500″. Any idea? When I remove the snippet code then my site came back. I have a plugin installed name LearnDash and Uncanny Owl. I don’t know if this might cause the conflict but I deactivated the uncanny own. Can anyone help? Thanks in advance.
Hi Marc, this might help: https://gravitywiz.com/documentation/snippet-troubleshooting/
Thx for the snippet! However, and this is probably due to Avada, although they disagree, the get_header and get_footer in de activate.php load the code ok, except for the Avada dynamic css and some Avada JS in the footer. Anyone else with Avada experiencing this problem?
Yes, I have exaxctly the same issue
A better solution would be to use WordPress’s template_include filter. This way you avoid exiting prematurely, which could matter for some themes and plugins.
Hey Andrew, thanks for the feedback. Where in the code do you advise using this?
@Andrew Beaumont : this completely fixed my Avada issue! YOU ROCK!! It now loads the css/js which which were not loaded with the default STYLESHEETPATH . ‘/gfur-activate-template/activate.php’;
Same question as @David Smith Where in the code do you advise using this? Thanks
Having same issue with Avada. Not sure where Andrew’s solution should be placed. Does anyone have this functioning correctly?