Members for Caldera Forms is a very simple membership system. With this add-on you can use Caldera Forms to add members to groups, and then use the shortcode or PHP function to restrict access to content based on group membership.
This document will show you how to implement the Members for Caldera Forms processor in your form. It will also show you how to do content restriction using the supplied shortcode and PHP function.
Make sure before continuing you have Caldera Forms 1.3.5 or later and Caldera Members plugins installed and activated on your WordPress site.
It is very important to keep in mind that this processor works by adding the current logged in user to a group or plan. Therefore you should only use this processor where a user is logged in. You can use the Caldera Forms users add-on to add user login and registration to your form, or you can use any other way to log in the user.
Using The Members Processor
Configuring The Processor
This simple processor only has two fields. The first field is Plan Name. This is a human readbable reference for the plan or group. The second is Plan Slug this setting is most important. Plan slug is how you will refernece the plan or group in the shortcode.
Keep in mind that both of these fields are magic tag enabled. That means that you could use the value of a field, such as a drop down field, to set which plan to add the user to.
Chaining Processors In Caldera Forms
Caldera Forms processors run in the order you see them in the processors tab, top to bottom. That list is a drag and drop interface by the way.
This means that if you wish to charge for your membership, you can add a payment processor followed by the membership processor. If the payment processor does not complete the payment successfully, then the membership processor will never run.
The Caldera Members plugin adds a shortcode and a function you can use to restrict access to content.
Using The Shortcode
In the post editor, you can use the
cf_members shortcode. This shortcode has one required parameter. That is
plan_slug. Any content within the opening and closing of that shortcode will be available only to those who have that plan.
This shortcode has an optional parameter
sign_up. You can pass the ID of a Caldera Form to display if the current user does not have the plan. This allows for showing a login and/ or sign up form to users who can not see the restricted content.
Using The PHP Function
Developers may also use the
cf_members_has_plan() function. This function accepts one parameter, which is the slug of a plan. It returns true if the current logged in user has that plan. Otherwise it returns false.
Here is an example of how to use this function in a theme template to restrict content or event to restrict access to a whole post:
Frequently Asked Questions
- Does the user have to be logged in?
- Can this plugin, log the user in or register the user? No. But our users add-on) can.
- Can this plugin require payment to join a plan?
- No. But if it is combined with one of our many payment processors you can add one of those earlier in the form. That way payment isn’t successful, the plan will not be set.
- This plugin doesn’t do much does it?
- Correct. That’s the point. There are plenty of quality, fully-featured membership plugins for WordPress. This one is super simple — just the basics. Build whatever you need by combining it with other Caldera Forms processors.
- I need a full-featured membership plugin, is this a good choice?