Now that you know how to control the display of menu items to visitors and members, let’s look at how to control access to widgets based on user role. There are two different plugins that can be used to achieve this.
Using the Display Widgets Plugin
One of those plugins I think she may already have installed here, it’s called Display Widgets. Is that one installed? It is not. I’ll add that now.
Control Based on Logged In Status
It’s a very simple application. You can use Display Widgets to control access but that access control is very simple. This plugins will work for you as long as you’re happy to control based on logged in status versus not logged in status.
Let’s come over here to Appearance and Widgets. And actually I’m going to take that custom menu again and add it to the sidebar. We’ll just give it a title of Member Menu and then select the Member Menu. Next you’ve got this choice here, “Show Widget for Everyone” or “Show Widget Logged-out users” or “Logged-in users”. And that’s one part of it.
Let’s choose to show it to “Logged-in users” only. Hit save and then the menu shows when you’re logged in but won’t if you’re not logged in. So you can use logged in or logged out status to control access and that’s the simple way to control access.
Using the Dynamic Widgets Plugin
The other way is to use a somewhat more complicated plugin called Dynamic Widgets.
Let’s come back over here to Plugins and Installed Plugins and I’m going to deactivate Display Widgets. This means that now when you go look at your Appearance and Widgets, that ability to control access is no longer there but what we’ll do is we’ll add in the plugin called Dynamic Widgets.
Control Based on User Role
Dynamic Widgets does in fact, allow you to control visibility based on user role not just logged in or logged out status. For many people logged in or logged out is all you really need but you might want to use another standard.
Good for Multiple User Roles
If you only have one membership level and everybody is going to see that content you can just use logged in and logged out status which makes it very simple to do. However, if you’ve got multiple user roles, this is the right plugin.
Dynamic Widgets says “Static” here. If you click on “Static”, now you can open up the role and it says “Show widget to everybody?”. Then it says, “Yes except for” or “No except for”. We’ll say show it to everybody. Say no that except for administrator and distributor.
Now this anonymous is an actual user role. This anonymous is an anonymous user that’s not logged in.
Let’s hit save and refresh the page. We’re logged in and we’re either the administrator or distributor so we can see the content. However, if we come back over here where we aren’t logged in we can’t see. Let’s log in and now we see it again.
So this gives you somewhat more granular control. It’s a little bit more complicated plugin to use so I generally teach beginners to use Display Widgets rather than Dynamic Widgets. In Joanna’s case, Display Widgets will do the job because she really only has one membership level that matters.