If you want to protect a section or sections of a post or page then simply wrap the section with the “emember_protected” shortcode.
The following screenshot shows an example of how a partially protected page may look like. You can protect multiple sections of the post/page using multiple blocks of section protection shortcodes.
Section Protection Video Tutorial
Take a look at the following shortcode examples. It will show you how you can use the partial protection feature:
Note: When you copy and paste the shortcode, make sure to paste it in the “Text” mode of the page editor to prevent any HTML code from getting copied.
Simple Section Protection Example
[emember_protected] Whatever content goes here is only visible to logged-in members who have access to this post or page. [/emember_protected]
Section Protection for Specific Membership Level Example
[emember_protected for="2-3-4"] Whatever content goes here is only visible to members who belong to the specific membership level specified above. [/emember_protected]
Where 2,3,4 are the membership level IDs that you want to allow access to this section of content.
Section Protection for a Specific Member
[emember_protected member_id="1"] Whatever content goes here is only visible to the member whose Member ID is 1. [/emember_protected]
Section Protection for Anyone Who is Logged In
If you want to just protect a section of a post or page for logged in member (you don’t care if the member’s status is expired or not) then use the following shortcode:
[emember_protected scope="verified_users_only"] Whatever content goes here is only visible to anyone who is logged-into the eMember system as a user (doesn't matter if his account is expired or not). [/emember_protected]
Section Protection for Anyone Who is NOT Logged In
If you want to just protect a section of a post or page for non-logged in member (only anonymous visitors will see this section) then use the following shortcode (can be useful if you only want to show a message to the anonymous users):
[emember_protected scope="not_logged_in_users_only"] Whatever content goes here is only visible to a non-logged in user (anonymous visitors of your site will see this message). [/emember_protected]
Section Protection for Expired Members Only
If you want to just protect a section of a page for expired members (only expired members will see the message) then use the following shortcode:
[emember_protected scope="expired"] Only the expired members will be able to see this message. [/emember_protected]
If you want to protect a section of a page for expired members of a particular level then use the following shortcode:
[emember_protected scope="expired" for="2"] Only the expired members from membership level 2 will be able to see this message. [/emember_protected]
Section Protection without the “Content is protected” Message
If you want to protect a section of a post or page without showing the “Content is protected” message to the non-logged in users then use the following shortcode (can be useful if you don’t even want them to know that there is a section of content there):
[emember_protected for="2-3-4" do_not_show_restricted_msg="1"] Whatever content goes here is only visible to members who belong to the specific membership level specified above. Also, the users who do not have access to this content won't see a "Content is protected" message. [/emember_protected]
Section Protection without the Protected or Expired Message
The following section protection option protects the section without showing the “Content is protected” or “Account is expired” message (useful if you don’t even want them to know that there is a section of content there):
[emember_protected for="2-3-4" do_not_show_restricted_msg="1" do_not_show_expired_msg="1"] Whatever content goes here is only visible to members who belong to the specific membership level specified above. Users who do not have access to this content won't see a "Content is protected" message. The expired members won't see the "Account is expired" message. [/emember_protected]
Section Protection Not For Specific Membership Level
If you want to protect a section and make it NOT visible to a particular membership level then use the following shortcode:
[emember_protected not_for="1" do_not_show_restricted_msg="1"] Whatever content goes here is NOT visible to members of membership level 1. All the other members can see this content. [/emember_protected]
Using a Custom Message for the Non Members
This section protection shortcode can take another extra optional argument which can help you customize the text/message that is shown to non members.
Here is an example usage:
[emember_protected for="2-3-4" custom_msg='This is a custom message'] The content goes here. this content will be hidden and only available to members of membership level 2, 3 or 4. [/emember_protected]
The following screenshot shows how this custom message is shown:
Section Protection Custom Message with HTML Link
You can use a HTML link in the custom message that you specify for the section protection shortcode. Remember to switch to the “Text” mode in the WordPress post/page editor if you are typing in HTML link code.
Here is an example shortcode usage:
[emember_protected for="2-3-4" custom_msg='This is a <a href="http://www.example.com">test link</a>'] The content goes here. this content will be hidden and only available to members of membership level 2, 3 or 4. [/emember_protected]
Note
Just remember that when you want to use section protection on a post or page you should not protect the full post or the category that the post belongs to. When you apply category protection for a category, all the posts in that category is fully protected (category protection overrides all the small section protections in the post).
Section Protection in Action
You can see an example of how the section content protection work on the eMember demo site.
@Rob, Yes you can have as many levels of protection on a post as you want. You just need to use the section protection (for each section you want different protection for) and specify which membership levels can see that section.
Example:
[emember_protected for=1] (1 being membership level 1)
Paragraph 1
[/emember_protected]
[emember_protected for=2-3-4] (2,3,4 being membership levels 2-4)
Paragraph 2-4
[/emember_protected]
and so on…
Hi
Is it possible to have two levels of protection on one post? So:
text 1
– Signed in members only –
text 2
– Upgrade to access the rest of this post –
Text 3, 4, 5 etc
Thanks
Rob
@Jean, There is a small typo in the shortcode which is why it is not working. See how the “M” is capitalized in the ending protection tag? That is wrong. Currently you are using the following incorrect tag:
[/eMember_protected]
The correct end tag should be the following (no capital letter):
[/emember_protected]
Copy and paste the shortcode from the documentation above and you will see the difference.
I thought I asked this already, but I can’t find it. I have a real problem here and have taken it down to the simplest level:
[http://screencast.com/t/GF2fapNv27]
It’s using a simple [emember_protected] put stuff here [/emember_protected], yet it still shows up even though I’m not logged in as shown here:
[http://screencast.com/t/LZ4XDeNUW1]
It still shows the content that should only be for members.
@Jordan, I don’t fully know the type of customization you are doing but I think the following post might be helpful for you
http://www.tipsandtricks-hq.com/wordpress-membership/wp-emember-miscellaneous-tweaks-248
How would i hide custom post fields for different levels?
You can set a redirection per membership level. So create a separate membership level for your admin user(s) and place the admins in that level. Now you can set this level to redirect to the admin dashboard.
Ivy,
Simple question. Can I have two different login redirects? For instance for site admins I want them to go to the “Admin Backoffice” while for silver members I want to send them to “Members Area”.
Is this possible. I looked over your site, did a search on your site and didn’t see anything.
Thanks,
RC
@Mike, You can use something like the [emember_protected scope=not_logged_in_users_only]
this would be used for the section you want non logged in users to see like a list of tutorials with just one or two active links.
Then you can use the [emember_protected for=1-3-5] and set which membership levels can seen the full list of active links. This way it is easier to manage the membership levels as you can specify which levels can see the content.
Does that make sense?
I have eStore and eAffiliate already. I also have WishlistMember which won’t do what I want.
If my site sells classes with 20 lessons (links), I want the first 2 lessons public for promotion purposes.
If you pay for the whole class then all of the lessons (links) become active.
The section restrictions work in theory. If you paid for class A and browse to class B unpaid, I don’t want all of class B content viewable.
I have hundreds of classes and think using levels would require way to much maintenance.
Think Lynda.com as a good example of what I want to do.
Can that be done with eMember and eStore?
With the word “Protect” we mean that only a member who has permission to see the content will be able to see it. Anyone else who does not have permission won’t see the actual content that is protected (the bit of content between the shortcode).
Hi!
Haven’t try the plugin yet but am interested in buying the plugin although I don’t understand how you use the word “protect” (?)
For example you say: “If you want to just protect a section of a post for non-logged in member (only anonymous visitors will see this section)”
For me I would write it like that: “If you want to just protect a section of a post for non-logged in member (EVERY LOGGED USERS WILL SEE THE POST EXCEPT anonymous visitors WHO WON’T see this section)”
Or do you mean “Display” when you say “Protect”?
In this case you should say: “If you want to just DISPLAY a section of a post for non-logged in member (only anonymous visitors will see this section)”
Don’t know if you understand my meaning.
For me “Protect” means “Hide” and it seems in eMember it means “Show”
For me the whole article is a bit confusing.
Could you help?
THANK YOU!
Roger
Hi, You can setup as many membership levels as you want. For each series you can make this a different membership level and protect it so only people that have purchase that series can view it.
Members can also be members of more than one membership level so if they buy Billy’s and Joe’s they will have access to both series.
If I’ve got a series of tutorials by Billy, a series by John and a series by Joe, can I set up separate membership access to each series? Can I sell separate subscriptions to each of these with eMember within the same site?
Thanks!
Yes you can protect custom post types with eMember. The customer posts types are protected the same way the posts are protected in eMember.
Is it possible to set protections for custom post types as well as pages, posts, and categories?
Thanks.
Thanks very much for your answer. This is exactly what i need.
@Vasil, this page should have some PHP code samples that will give you ideas as to how to achieve this:
http://www.tipsandtricks-hq.com/wordpress-membership/wp-emember-miscellaneous-tweaks-248
Hey, i want to protect buttons, links and content inside the theme files and not from editor – based on the membership levels. if it’s first level – show this and if it’s a second level show that. Is there a php code that i can use to do this. Thanks in advance for your response.
@Bob, did you protect this post under general protection or did you try protecting is for particular membership levels? for example:
[emember_protected for=1-2-3]
Your protected content goes here…
[/ emember_protected]
I just purchased the eMember plugin. I’m having same issue as Erik, above.
I need to have teaser content display to everyone, then, have a cutoff below which there needs to be protected video viewable to members only.
I have tried the short code listed above but it doesn’t work.
[emember_protected]
[flashvideo file=http://myvideo.mp4 /] (for example)
[/ emember_protected]
But the video still shows to the whole world. AND the teaser content doesn’t display on the home page.
Are you using it on your blog post or just on a normal page? Can you please post a link to your blog URL?
You can always use the “Section Protection” feature of eMember to get the same effect as the more tag protection if you want to create teaser sections:
http://www.tipsandtricks-hq.com/wordpress-membership/how-to-protect-a-section-of-a-post-or-page-88
I cannot get the “teaser content” more tag function to be work at all. I have the ‘more tag’ option checked, I am not restricting any access to categories, only to the posts.
All I get is “Please Login to view this Content.(Not a member? Join Today!)” just like you would if you were restricting access to the entire category or had the ‘more tag’ function turned off. I realize the way you described above would work as well but I don’t need it that customized…just trying to figure out why this ‘more tag’ option is not working for me.
Thank you,
Erik
Hi, The following video will explain more about how content protection works (Video 5):
http://www.tipsandtricks-hq.com/wordpress-membership/wp-emember-quick-setup-and-usage-video-tutorial-132
Is this a suitable method for protecting file downloads?
For example, can a member who has access to the file download link, simply email the download link to a non-member…?
I need to protect file downloads (mainly pdf’s) at different membership levels i.e.
*Non-subscribers – get to view a link that says “available only to subscribers” or similar
*Free subscribers – get to view free downloads
*Paid subscribers – get to view free + paid file downloads
Potentially there will be more subscription types with downloads only available to them.
Is this possible with eMember?
Best regards, Brian
@Jeffrey, the section protection requires two tags (start and end) so it’s not possible to call one function from the template and have the section protected but there is other ways to do what you are after.
You can use the following bit of code on your template file to protect some content:
<?php
global $auth;
$user_id = $auth-?>getUserInfo('member_id');
if (!empty($user_id))
{
echo "This secret message is for member's only";
echo "Any content here can only be viewed by members";
}
?>
I can give you more sample code if you post what you are after in the forum:
http://www.tipsandtricks-hq.com/forum
Hi,
Great plugin! Is there a template function that can be used? Basically, I want to wrap the_content inside the function of protection for 2 membership levels always, then have another custom field of text above it that is for the teaser content. This is just so I don’t have to be super paranoid when creating posts, and there is a definite “this will show” and “this will not” in my mind because of the different fields I am typing into.
Secondly, is there anyway for the search engines to bypass this, then cache the page (with the premium content shown) and then anyone could see it?
Thanks again!
Not sure I understand what you mean by
“insertin number of ‘total number’ on the subscription page”
If you can explain a bit more then I should be able to give you guidance. It is probably a good idea to post it on the support forum so we can have a discuss this:
http://www.tipsandtricks-hq.com/forum
Hi,
I would like to insert the number of ‘total number’ on the subscription page. On the dashboard_menu file, I found this php code :
count; ?>
How to transform it to integrate the info into a page or post on the blog ?
Thanks for all.
nicolas
In the “Add/Edit Membership Level” did you give access to “posts”, “pages”, “categories” for these levels? Sometimes people forget to give this global access when creating the membership level.
I have set up three memberships and set all the protections and granted access to appropriate levels.
But when I click on the categories I get all the posts listed but they all say “your membership doesn’t allow access” or something like that.
Help!?