This MAY now be somewhat redundant due to the release of Gravity Forms User Registration Add-on version 3.5, which contains a {set_password_url} tag that you can put in emails that sends users to a password setting screen. But..

I was struggling this week with a user registration flow (don’t let anyone tell you this is easy). I know it’s not great practice, but for simplicity’s sake I wanted to generate a password for a user and send it to them in an email – but not in the default email that WordPress sends with user login details, as this is short and uninformative. I wanted to customise that message.

It turns out that Gravity Forms sends it own version of this email and it’s THAT that you need to customise.

The GF User Registration add-on has a function: gf_new_user_notification() in file class-gf-user-registration.php

This function claims that it “Overrides wp_new_user_notification”. To explain that further, wp_new_user_notification is a “pluggable” function (plugins can override it). Because of this is sounds like gf_new_user_notification replaces wp_new_user_notification. But it has a different function name. If the GF version were overriding the pluggable WordPress core version then it would have the same name.

The truth is that the GF version does NOT override the WP core version of this function.

The User Registration Add On (I’ll call it URA from now on) has its own “create user” path in the code that avoids the WordPress core “create user” path. So while the effect of gf_new_user_notification is that it “overrides” wp_new_user_notification, wp_new_user_notification is actually avoided and gf_new_user_notification is used instead.

So if you had a GF UAO registration form, and a regular WordPress registration form, the GF form would send a different notification to the WP form.

Anyway, that’s what I found when digging.

I won’t go into details, but the way to customize the GF new user notification is to:

  • Create a small, single-file plugin that has a plugin header
  • Copy the gf_new_user_notification function from class-gf-user-registration.php
  • Paste this function into the new plugin file you’ve created
  • Activate the new plugin