This entry is part 13 of 22 in the Customizing Restrict Content Pro Series
- Mail Chimp for Restrict Content Pro
- Add Custom User Meta Fields to Restrict Content Pro Registration
- Removing “Restrict This Content” Meta Box in Restrict Content Pro
- Restrict Content Pro – Campaign Monitor
- Restrict Content Pro – Graphs
- Restrict Content Pro – Stripe Payment Gateway
- Hide wp-login.php with Restrict Content Pro
- Add a Agree to Our Terms of Use Field to Restrict Content Pro
- Template Files in Restrict Content Pro
- Template Files in Restrict Content Pro
- Adding Custom User Fields to Restrict Content Pro
- Custom Capabilities in Restrict Content Pro
- Custom Capabilities in Restrict Content Pro
- Restrict Content Pro – Enforce Strong Passwords
- Restrict Content Pro – Braintree Gateway
- Restrict Content Pro – WP Job Manager Bridge
- Restrict Content Pro – Download Monitor Bridge
- Restrict Content Pro – Wysija Add On
- Restrict Content Pro – CSV User Import
- Restrict Content Pro – Affiliates Add-On
- WP Push Releases Restrict Content Pro Extension
- Restrict Content Pro – Math Verification
Restrict Content Pro, my plugin for selling access to premium content, extends the roles and capabilities API in WordPress, allowing you to fine tune the levels of access each user role has to the admin pages for Restrict Content Pro. This means that you can easily setup user roles that only have access to the Members area, and another role that only has access to the Payment History, and yet another user role that has access to everything but Payment History.
Out of the box, Restrict Content Pro sets up the following capabilities:
- rcp_view_members
- rcp_manage_members
- rcp_view_levels
- rcp_manage_levels
- rcp_view_discounts
- rcp_manage_discounts
- rcp_view_payments
- rcp_manage_payments
- rcp_manage_settings
- rcp_export_data
- rcp_view_help
Each _view_ capability gives the user role permission to view data, and each _manage_ capability gives the user role the ability to modify data.
These capabilities are all given to the administrator role when Restrict Content Pro is installed.
For example, if you wanted to allow the editor role to view the Members section of your site, you’d give the editor role the rcp_view_members capability.
Adding capabilities to user roles can be done programmatically via a WordPress helper function or via a UI provided by a plugin, such as Members by Justin Tadlock. We will look at both quickly.
Adding Capabilities via Code
The get_role() function allows us to setup an instance of the WP_Roles class and gives us access to the details of the provided role. Using the add_cap() method, we can easily add a new capability to the role:
<?php function rcp_add_member_caps() { // gets the editor role $role = get_role( 'editor' ); // Allow Editors to view Members in Restrict Content Pro $role->add_cap( 'rcp_view_members' ); } add_action( 'admin_init', 'rcp_add_member_caps' ); |
Note: the add_cap() method writes to the database, so it’s better if you only run this once during plugin or theme activation.
With this method, you can add (or remove) any of the capabilities above to any role you wish.
Using the Members Plugin
The Members plugin linked above provides an interface for creating new user roles and modifying existing roles.
Once activated, you will have a new Roles item under the Users menu:
Simply click on the Role that you wish to edit and then select the rcp_ capabilities you wish to enable for the role:
Once you have selected (or deselected) the appropriate roles, click Update Role. That user role will now have permission to access the areas of Restrict Content Pro you have designated.
Pippin,
How can I create a separate ‘Upgrade’ form, for users who have already registered with a free membership to have the option of paying to upgrade their membership?
Thanks!
Affle
Open a support ticket and I’ll be happy to assist you as best I can: https://pippinsplugins.com/plugin-support
Pippin,
Hi, can RCPro manage membership that will pay to publish their post and make recurring charges on a monthly basis? They should only have access to their posts, with full editing/updating capabilities. I understand RCPro to restrict the viewing levels of the members, not the publishing of posts.
thanks,
Jon
No, sorry.
Pippin,
Is there way to enable email verification for new users?
No, sorry.
Hello,
Is it possible to activate the Restrict this content section on a post/page only to a user who has a certain role, let’s say editor and for other lower roles not to be displayed?
Thank you
Yes, but it is limited to the default roles inside of WordPress.
Hi Pippin,
You mention in this post [ The Members plugin linked above] but I cannot find which plugin you are talking about…
I would like to see the ‘roles’ menu under ‘users’ but I don’t see it with my standard install of RCP.
Ta
This is the plugin: https://wordpress.org/plugins/members/
Thanks very much for that link Pippin.
Can memberships payment be made biannually, and automatically charged ?
Yes.
Hello, what a wonderful plugin. I use this in a webshop and I need to assign access control (Restrict purchasing of this product to:) level 1 to all the products in my site. How can I do that without manually configure every singel product by hand?
HI i am wanting to display RCP members on a page using https://wordpress.org/plugins/simple-user-listing/ I am able to view all members using [userlist role=”subscriber”] However, I am wanting to list just one subscriber member group with an id of 1. Can anyone advise i have tried support. I also tried https://wordpress.org/plugins/members/ to add Capabilities – but am a bit lost. Thanks for any tips Regards Michael
I am able to create the new roles that I require but within Page or event, etc configuration “Restrict This Content” does not show the custom roles. This makes adding new roles a completely worthless capability. How do I enable this?
Custom role restriction isn’t something we support at this time. It’s on our todo list but there’s not an immediate ETA for it yet.
Hi Pippin,
Referring to above question by Kevin, is this custom roles capability now available in RCP?
Hi Pippin,
We have a website developed using WP. We have pages and other custom sections like products, news etc. Under products we can add new products, and then link the new product to appropriate section under pages, and publish the new product. News does not need to be linked to a section in pages as each news is a new page itself.
What we are looking for is – in each section, say product, have one user who can modify content, i.e. add a new product, its pictures etc. in media center, but can not publish it. Another user can link the new product to appropriate section under pages and publish it. Both these users should not be allowed to modify content in News section.
Similarly we will have 2 users who can manage news section. Meaning, each area, we need to have 2 users who manage the content.
Can you suggest something easy to install/implement. Easy means no coding.
Thanks
Krishan Vats
Hi there, I use Easy Digital Downloads Content Restriction (made by Restrict Content Pro). If I upload an Apprentice Course to a page on my website that is only accessible by paid members, will the course automatically only be accessible to the paid members too? Or I will I need to undertake further steps?
Yasmine