Build Your Own Business Website header image

How to Build a Free Membership Site – Part 12 – Advanced Content Protection Using Thesis 2.1

Difficulty Level -

Filed Under Topics - , ,

Listed Under Lesson Subjects -

Applies to -

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

Now that you know how to control access to pages and posts for a free membership site in WordPress it’s time to look at advanced content protection using Thesis 2.1.

Use Display Content by User Role Box

We’re going to do that on our example site and we are going to install a box called Display Content by User Role. You can find that under Member Benefits and Thesis 2.1 boxes. This doesn’t help non Thesis 2.1 users but for Thesis 2.1 users you do have this built-in ability using this box.

You can download this box and then add it to your skin. You use it in the skin editor. In this case, we’ll come over to Thesis and Manage Boxes. We’ll upload a box and choose a file. This is where it’s sitting on my computer, display-content-by-role, add that.

Click the checkbox beside it and save the boxes. Let’s go to the single template because we are protecting content on a single page..

Choices for Displaying Content

First we’re going to create the new box that is Display Content by Role. I’m going to say “Display to guest” and here are your choices.

  • Display to everybody
  • Display only to non-logged in users
  • Display to all logged in users or
  • Check these boxes for the roles that you want it to be displayed to (administrator, editor, author, contributor, subscriber, distributor or all)

Hide from Administrator Option

The trick to this is that sometimes you want to see what the page looks like as a user while you’re still logged in as the admin so you can also check this box “hide from administrators”. That just makes it so when the administrator is taking a look at it to make sure it looks right, they can tell that it’s being hidden.

Example: Display to Non Logged In Users

For example, let’s display this to non-logged in users only and we want to hide it from the administrators. Say okay to this and then we’ll put a text box in there and we’ll call this “Protected Content Message”.

I’m going to drag the Protected Content Message into Display to guest and then I’m going to come down here and drop it in my post box and go down below the content. Save that, come back over to the site and we’ll go to skin content and now we’re looking at our Protected Content Message.

Here we can do what we did before, “I’m sorry but the rest of the content on this page is available to my distributors only. To learn how to become one of my distributors visit this link”. Then we’ll put the link in there again. Get that link, come back over to my a href= and paste it. I’m going to make this bold as well.

Save that and reload it. We need to edit this post so that our access role is distributor, get rid of that shortcode so that it ends here, Part 1 of 24day2skinny Blogging Academy. Because we’re the admin we don’t see any message.

However, if we come back over to that not logged in, come back down to our Welcome Business Builders. There’s the message. This little thing here is actually showing up below all of this because all of this is added to the content. That’s what’s happening here. All of this is being added directly to the content via other plugins so this isn’t really showing up quite where you’d want it to.

Example: Display to Members Message

So what you can do instead of that is come back over to our skin editor. We’re going to select another box to add and we’ll say Display to Members and we’re going to say to all logged in users. Except we’re not doing it on the homepage, we’re doing it on the single page. We’ll drag that into the Post Box and down here.

We’ll take the Content and drop that into the Display to Members. Open the tray and we’ll take the Excerpt and we’ll display that to the guest like that. So the guest is going to see the Excerpt and that message, the member is going to see the Content. So here it is, “Welcome Team! This page will be dedicated to, etc.”. There it is.

If you’re not logged in now you see that little message here and as soon as you log in you should see the full content. I’m sorry because I’m using that shortcode on that. So if we come back up here and edit the post, we can actually get rid of the shortcode all together.

So now if you’re logged in you’ll see the full post. Well, I may have miscalibrated that. Let’s go take a look at that again. Skin editor, Display to guest to non logged in users only. Okay Display to Members, to all logged in users. I guess I failed to save that.

Brett is noting that…yes, you’re absolutely right Brent. So this is in the single template and I really need to create a custom template for this. In fact, I’m going to do that right now. Add New, say Protected Single, create the template and then I’m going to copy this single over to this.

Save the template, come back over to single and drag that into the tray and drag that out. Actually, I’m going to go without saving this template. Make sure we drag the right stuff out of this. Okay, Display to guest, drag that into Post Box and then drop it into the tray.

Then shift+drag Display to guest out and drop it in the selected box to add, Display to Members. Put it into Post Box and then drag it back into place and drag out Display to Members and save that template.

Right now then, this is using the single template and everything is automatically displayed. We can come over here to edit this post and choose a Protected Single template. Probably should change that to Protected Post. We’re logged in here and this looks just fine. If we come back over and reload this, we are also logged in here. Let’s log out. I’m not sure what’s going on here.

If we come back over and look at that post Welcome Business Builders, we’re getting the message, “Welcome Team! This page will be dedicated…”, “I’m sorry but the rest of this page is available to my distributors only.” So we’ve got that part working.

Then if we log in, test-distributor, there you have it. I think something that I’ve created here is broken slightly. So we’ll come back over to the Protected Single and we’ll fix it. So this is Display to Members and we’re just going to choose all of these and then I’m going to go fix that thing.

Now you have the whole thing. So the checkbox is display to all logged in users is not working correctly at the moment but I will fix that so that it does otherwise, if you just check all of the user roles, obviously it works just fine.

Now this will work with anything. This will work with menus, you could wrap menus. This is how I’ve actually traditionally taught people how to have a member menu versus a visitor menu. The member menu is wrapped inside of one of these Display Content by Role boxes and in fact, both menus are wrapped up in one of these display boxes.

You can do that really with anything. You could have a members sidebar and a non-member sidebar or widget area. Anything that you can manipulate in the Thesis 2.1 skin editor, you can use this box to control display of the content based on the role of the user.

0 Comments… add one
0 comments… add one