Now that we’ve added a member’s login to the sidebar, the next thing we’re going to do is take a look at how to protect content. At least some parts of the content protection are very simple to do.
Add Content Protection to a Public Page
We’re going to edit this private page here and instead of password protected, we’ll make it public. Say okay and then we’ll come down to the very bottom of the page and in Content Protection check the role of Distributor.
Content Protection limits access to this post content to users of the selected roles which in this case is Distributor. So only the distributor should be able to see this and actually, it’s not only the distributor it will be the distributor plus anybody who has permission to edit this page. So as the Admin I’ll be able to see it.
Here’s that protected content, “Welcome Business Builders”. If we go to that content you can see I’m currently logged in meaning that I can see all of the content. However, if I come over here to the site and instead go to the protected content…well obviously this is a page that I also have to empty the page cache for.
I’m going to disable caching here for the time being so I don’t have to keep doing this. Go to Plugins, Installed Plugins and deactivate the caching.
View the Protected Page
Let’s go to a page not logged in. And here’s the message “Sorry but you do not have permission to view this content”. So we’re showing the title and we’re showing the meta information and that kind of stuff but once you get to pass the featured image, you get this message, “Sorry but you do not have permission to view this content”. So that’s what happens with this.
It tells you that you can log in. If we were logged in you’d be able to see the content so let’s log in as test-distributor. Now that we’re logged in we can see the whole post. As soon as I log out, actually this log out takes me back to that screen.
When Should Caching Be Used?
I have a number of questions about caching. Richard asks, “When the forum is active is caching advised?” Actually, you pretty much need to exclude forum pages from caching because caching does interfere with the ability of a forum to work. Really, caching is problematic in lots of different applications.
It’s not a problem in a blog or a regular website which has just pages and post, that stuff works just fine. What doesn’t work well are things like eCommerce plugins where you take money or forum plugins, anything that is dynamic and that changes regularly can essentially be messed up by caching.
Julie asked, “Is caching something that we should do or not do in general?” In general caching is not a good idea, it’s never a good idea when you are in development and it’s only a good idea if you have a site that doesn’t have dynamic content.
Benefit of Caching
The only actual positive benefit of caching is that it can speed your site up and so if you’ve got a largely static site then caching can be a good thing.
Obviously, their server is having problems right now and caching is not helping her site at all today. BYOBWebsite does use caching in fact, it uses the same caching plugin she is using but it’s such a complicated plugin to manage and to setup.
Actually I paid somebody specifically to do it for me and I don’t do it myself because it’s a very complicated plugin especially with all the different things that BYOBWebsite has going. On the other hand, especially for visitors it significantly decreases the wait time for them to view a page.
I actually have it turned off entirely for everybody who’s logged in. So if somebody is logged in they don’t see anything cached.