It’s no secret that the team here at iWitness Design is a BIG fan of Restrict Content Pro. We use it on many client sites and even have several add-ons that we’ve built for it over on Skillful Plugins.

One of the reasons we love RCP so much is because of its simple interface and customizability. In many ways it’s like a framework that you can use to build any kind of membership site.

One of the ways that we help our clients is by optimizing the registration flow. Sometimes this is with a custom UI that we build (like the registration interface for StudyChurch) and sometimes it is as a simple integration with a super flexible registration system like the one that Gravity Forms offers.

In this article, I’m going to show you how to easily connect your RCP user registration to Gravity Forms.

Setting up Restrict Content Pro

There is nothing special that you need to do on the RCP side of things to make this work; simply setup your subscription levels as you normally would. Bear in mind the IDs assigned to these subscription levels as we’ll be using them when we setup our registration form.

An important note here. Using Gravity Forms for user registration bypasses all of the payment mechanisms of RCP. So my recommendation is to register the user as a free member initially and then upsell once the member is logged in.

Setting up Gravity Forms

To register new members through Gravity Forms, you will need the Gravity Forms User Registration add-on. Setup the user registration form as defined in the documentation.

Now, at the bottom of your registration form, add 2 new fields to define the meta that we will need to tell RCP that a user has registered.

  • Member Status – This is the status of the newly registered member. Use ‘free’ for free subscriptions and ‘active’ for paid subscriptions.
  • Subscription Level – This is where you will put the subscription level that the user is registering for. If there is only one level, store it in a hidden field, otherwise, you can use a dropdown or radio field here.

Now in the User Registration settings for the form, add a couple of new user meta fields to correspond with the Member Status and Subscription Level.

  • Member Status → rcp_status
  • Subscription Level → rcp_subscription_level

That’s it! You can now use all the power of Gravity Forms to handle user registration, notification, and membership approval!

Common Problems

Regarding subscription incrementation

Using Gravity Forms to register new users will not automatically increment the subscription level count in the RCP settings area. In order to do that, you can implement the following code:

   /**
     * Make RCP aware of our new subscriber
     *
     * @param $user_id
     * @param $entry
     *
     * @since  1.0.0
     *
     * @author Tanner Moushey
     */
    function iwitness_fix_rcp_count( $user_id, $entry ) {
        // make sure we have our rcp_status defined
        if ( ! $status = get_user_meta( $user_id, 'rcp_status', true ) ) {
            return;
        }

        // The RCP Set Status function triggers a lot of important actions
        // remove the status we set and reset it using the RCP function
        delete_user_meta( $user_id, 'rcp_status' );
        rcp_set_status( $user_id, $status );
    }
    add_action( 'gform_user_registered', 'iwitness_fix_rcp_count', 10, 2 );

What about paid subscriptions?

Like I mentioned earlier in this article, using Gravity Forms to handle registration does not support RCP’s payment system. So recurring paid subscriptions are not going to renew correctly. You can setup payment for subscriptions with one-time-payments using Gravity Forms, but that won’t show up in the RCP statistics.

If this piece of functionality is critical for your project, reach out to us and we can implement the custom code needed to set this up.

 

Reader Interactions