WordPress Member Directory Plugin + Community (CMEDC) + WordPress Restricted Site Access (SAR) - Use Case - How to Allow Access to the Expert Directory to Logged-in Users Only
Use Case - How to Allow Access to the Expert Directory to Logged-in Users Only
This guide requires:
- WordPress Member Directory plugin - This guide uses version 2.4.7.
- Member Directory Community Add-On - This guide uses version 2.2.7.
- WordPress Restricted Site Access - This guide uses version 1.8.1.
Introduction
The WordPress Member Directory plugin enables you to create a comprehensive listing of experts or members.
The Community add-on lets other users (logged-in or not) create and manage their expert profiles.
WordPress Restricted Site Access is a plugin that allows you to create a membership and content restriction solution. The content restriction is based on user WordPress roles and if they are logged in or not. Choose which post type, category or even specific page should be locked - and to whom. In this use case we will use it to restrict access to the expert directory.
Use Case Front-End
Restricting expert pages:
Restricting directory index page:
Restricting menu items:
Use Case Assumptions
In this example use case guide, we'll cover how to allow only logged-in users to access a listing on your site.
We consider that you have already bought all of the listed plugins and add-ons, but not installed them yet.
It follows:
- Installing the plugin
- Quick recap
- Initial conditions
- How to restrict expert profiles
- How to restrict expert directory index page
- How to restrict suggestion form
- How to hide links to pages in the site menu
- End result
Installing the Plugin
The process is the same for all CM plugins and add-ons.
- Download the plugin from your customer dashboard.
- Log in to WordPress and navigate to the WordPress Admin → Plugins settings.
- Click on Add New.
- Activate it and add the license.
Learn more: Getting Started - Plugin Overview
Quick Recap
In this use case guide we will focus on how to restrict the access to the directory for logged-in users only.
If you still have questions about creating an expert directory and setting up a form for suggesting new expert pages, please chck these use cases:
- WordPress Member Directory Plugin (CMED) - Use Case - Creating an Expert Directory From Scratch
- WordPress Member Directory Plugin + Community (CMEDC) - Use Case - Creating Directory Where Users Suggest Experts
You can also learn more about the plugin for restricting content in this use case guide:
- WordPress Restricted Site Access (SAR) - Use Case - Blocking Site Access to Certain User Roles or to Guest Users Only
- WordPress Restricted Site Access (SAR) - Use Case - How to Build Drip Content Posts
- WordPress Restricted Site Access (SAR) - Use Case - How to Limit the Access to Specific Post/Page On Specific Day
- WordPress Restricted Site Access (SAR) - Use Case - How to Control Your Site Menus By the User Role and Type
Initial Conditions
Before restricting access to your expert directory, it’s important to understand the default structure of the plugin’s pages and access rules.
Once the WordPress Member Directory plugin and Community add-on are installed and configured, you can find links to the index page and the suggestion form page at the top of the of the plugin settings:
For easier access, you can also add these links to your site’s menu, ensuring users can quickly navigate to the directory and suggestion form pages:
By default, both the index page and expert pages are accessible to all site visitors. The access to the expert suggestion form can be limited to specific user roles only.
The index directory page and the page with the suggestion form are standard WordPress pages that contain shortcodes to output the content. Expert pages are custom post type pages. For both of these cases we will use different methods of restrictions.
With these default settings in mind, let’s proceed to configure restrictions, ensuring only logged-in users can access the directory and related pages.
How to Restrict Expert Profiles
Let's start with restricting the access to expert pages to logged-in users only.
To do this, navigate to Admin Dashboard → CM Site Access Restriction Pro → Settings → General tab.
First, we can configure basic settings. A few settings that we are going to consider now are:
- Restriction type - Here you can choose the way how to restrict the content - fully or partially (allows to show either only certain % at the beginning of the page, or hide specific parts). For our use case we are going to hide full content of the chosen pages, so we choose Restrict full content. Once the not allowed user visits a restricted page, he will see a relevant message.
- Access Denied page URL - As an alternative to just showing a restriction message to not allowed users, you can redirect them to the specific page.
- Login page URL - Another alternative to showing a restriction message, you can redirect users to the login page.
If you are not going to redirect users to another page when they visit restricted page, you can customize the message that they will see. It can be done under the Labels tab, in the first option access_denied_text.
Now head to the Post Types tab. This tab has a list of all actual post types used on your site, and you can define restrictions specifically for each post type.
Scroll down and find the post type Expert. Choose the option Access restricted to logged-in users and save the settings. Now guest users will not be able to access expert pages.
Front-end result:
How to Restrict Expert Directory Index Page
Now let's restrict the access to the index directory page. To restrict the access for a specific page, start editing it.
The WordPress Restricted Site Access plugin provides a metabox for overriding global restriction settings. Find the metabox Site Access Restriction and choose the option Access restricted to logged-in users. Then click Update to save the changes.
After that, guest users will not be able to access the directory index page.
Front-end result:
How to Restrict Suggestion Form
The Member Directory Community add-on has an option to define which user roles are allowed to suggest new experts and edit them. To configure it, navigate to Admin Dashboard → CM Expert Directory Pro → Settings → Community Expert tab.
Scroll down and find the option Who can add a expert. So, to allow the access to logged-in users only, choose all needed user roles except Anonymous, then save the changes.
As a result, when guest users visit the page for suggesting experts, they will see a message that informs about the list of allowed user roles:
Additionally, we can restrict this page the same as the directory index page. We can do it either using a metabox when editing a page, or we can use one more method that the WordPress Restricted Site Access plugin provides.
Navigate to Admin Dashboard → CM Site Access Restriction Pro → URL Filters.
This page allows you to restrict access to some page based on its URL. Click Add new filter, and add needed URL to the relevant field - it also accepts simplified URL form, so it's not necessary to provide full URL that includes the site domain. The choose Access restricted to logged-in users and click Save filters.
Now this page is restricted similarly to expert pages and directory index page.
Front-end result:
How to Hide Links to Pages in the Site Menu
If you added links to the directory index page and page for suggesting experts to your site menu, and don't want to display them to guest users, the WordPress Restricted Site Access plugin has options to achieve it.
Navigate to Admin Dashboard → Appearance → Menus.
Expand needed menu item and find the option Visible for. Here you can choose if to show it to all users, logged-in users or guest users only. Choose Logged In Users.
When the option Logged In Users is chosen, you can also choose if to make the menu item visible to all logged-in users or to specific user roles only. In our case we choose the option All roles. Let's do it for both pages - directory index page and page for suggesting experts. Don't forget to click the button Save Menu to save the changes.
Front-end result:
End Result
Following instructions found in the plugin and guides, you should be able to successfully restrict access to the expert directory and its related features, ensuring only logged-in users can view or interact with the directory..
Use Case Front-End
Restricting expert pages:
Restricting directory index page:
Restricting menu items:
More information about the WordPress Member Directory Plugin Other WordPress products can be found at CreativeMinds WordPress Store |
|
Let us know how we can Improve this Product Documentation Page To open a Support Ticket visit our support center |