Allow Site Creation to be Conditional with User Registration Add-on

The problem: You want to register users and allow them to optionally specify if they would like to create a site with their registration as well.

The Gravity Forms User Registration Add-on supports creating a new site by mapping submitted form data to the corresponding site data required to create new WordPress site on a Network-enabled install.

User Registration Network Options

The issue is the feed is static and cannot be changed based on user input. If the registration feed has the option enabled, a site is created; if not, a site is not created.

The Solution

As of version 1.4.3, the User Registration add-on has added support for multiple feeds. This means that we can create multiple registration feeds for the same form and use the “Registration Condition” option to indicate which feed should be used based on the specified user input.

The plan is to create a field on the form that the user can select/deselect to indicate whether they want a site created. We will create two feeds. One to handle registering the user and creating a site and another to only register the user. We will then configure the “Registration Condition” option for each feed so that the correct feed is used by the User Registration add-on dependent on which option the user selected.

  1. Add “Create a Site?” field to the form
  2. Create a feed to register user and create site
  3. Create a feed to only register user

Step 1: Add “Create Site?” field to the form

Go ahead and open up your form for editing. Add a checkbox field and label it whatever you’d like. In my case, I’ve labeled the field “Create a site?”. I then add a single option labeled, “Yes, please create my new site!” Again, the labels here are not significant. Your completed field should look something like this:

Step 2: Create a feed to register user and create site

Our first feed will handle registering the user and creating a new site on the WordPress network. Map the user registration fields as you desire. Be sure to enable the “Create Site” and map these fields as well.

When you get to the “Registration Condition” option, select the field we created in Step 1 from the first drop down, select the “is” option from the second drop down, and select the “Yes, please create my new site!” option (or whatever your affirmative option is) from the third drop down.

User Registration Condition: Feed for Registering User and creating Site

Perfect! This feed is now configured to register the user and create a site when the user checks the “Yes, please create my new site!” option!

Step 3: Create a feed to only register user

Our second feed will handle only registering the user and not creating a site. Use the same settings you specified in the first feed and map the user registration fields accordingly. Make sure that the “Create Site” option is disabled.

The “Registration Condition” option will be configured a little differently here. Select the “Create a site?” field we created in Step 1 from the first drop down, select “is not” from the second drop down, and finally, select the “Yes, please create my new site!” option (or whatever your affirmative option is) from the third drop down.

User Registration Condition: Feed for only registering user

Hot business! This feed is now configured to only register the user (and not create a site) when the user has not checked the “Yes, please create my new site!” option!

Summary

This is the easiest way to accomplish optional site creation without touching code; however, if you find yourself wanting/needing to accomplish the same feat from a single registration feed, let us know in the comments and we’ll be happy to share a super simple snippet that can do just that!

Comments

    1. David Smith
      David Smith Staff October 20, 2015 at 6:27 pm

      Nope, the UR 3.0 release is more for developers and future development than streamlining any of the processes.

  1. Randall Camacho
    Randall Camacho December 18, 2014 at 2:56 am

    ok i got it to work,

    suggestion to make registration process look cleaner ;

    1 – use page breaks with just user registration requirements on first page. 2 – “Create a site?” checkbox with site details on second page. 3 – however, i used gravity perks “Limit Checkboxes” for two checkboxes. 4 – one for “with” and the other for “without” site. 5 – added conditional logics to the extra site registration fields to show only if one of the checkboxes are checked (with site).

    great tutorial, thanks again.

    oh, and i also use the “auto login” in GP which is solely what i bought it for then realised the “Limit Checkboxes” and i’m sure i would make use of the others.

    Reply
  2. Randall Camacho
    Randall Camacho December 17, 2014 at 11:34 pm

    hi this is exactly what i was looking for, gonna try it out now and post back my experience.

    please feel free to share snippet for single registration feed. would give that a try as well.

    great stuff !!! thanks again.

    Reply
  3. rc
    rc November 18, 2014 at 11:52 pm

    very useful and intuitive tutorial. the user registration add-on is supposedly designed specifically for buddy press and multisite, and should therefore have this option easily built in.

    thanks again for this great tutorial.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.

Grab a bundle of free Gravity Forms plugins

Enter your email and receive our most popular free plugins and snippets, plus access to hundreds of others.

This field is for validation purposes and should be left unchanged.