Advertisement
pusatdata

WP E-Member: Shortcode Content Protection

May 30th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.17 KB | None | 0 0
  1. Simple Section Protection Example
  2. [emember_protected]
  3. Whatever content goes here is only visible to logged-in members who have access to this post or page.
  4. [/emember_protected]
  5.  
  6. Section Protection for Specific Membership Level Example
  7. [emember_protected for="2-3-4"]
  8. Whatever content goes here is only visible to members who belong to the specific membership level specified above.
  9. [/emember_protected]
  10. Where 2,3,4 are the membership level IDs that you want to allow access to this section of content.
  11.  
  12. Section Protection for a Specific Member
  13. [emember_protected member_id="1"]
  14. Whatever content goes here is only visible to the member whose Member ID is 1.
  15. [/emember_protected]
  16.  
  17. Section Protection for Anyone Who is Logged In
  18. 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:
  19. [emember_protected scope="verified_users_only"]
  20. 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).
  21. [/emember_protected]
  22.  
  23. Section Protection for Anyone Who is NOT Logged In
  24. 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):
  25. [emember_protected scope="not_logged_in_users_only"]
  26. Whatever content goes here is only visible to a non-logged in user (anonymous visitors of your site will see this message).
  27. [/emember_protected]
  28.  
  29. Section Protection for Expired Members Only
  30. 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:
  31. [emember_protected scope="expired"]
  32. Only the expired members will be able to see this message.
  33. [/emember_protected]
  34.  
  35. If you want to protect a section of a page for expired members of a particular level then use the following shortcode:
  36. [emember_protected scope="expired" for="2"]
  37. Only the expired members from membership level 2 will be able to see this message.
  38. [/emember_protected]
  39.  
  40. Section Protection without the “Content is protected” Message
  41. 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):
  42. [emember_protected for="2-3-4" do_not_show_restricted_msg="1"]
  43. 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.
  44. [/emember_protected]
  45.  
  46. Section Protection without the Protected or Expired Message
  47. 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):
  48. [emember_protected for="2-3-4" do_not_show_restricted_msg="1" do_not_show_expired_msg="1"]
  49. 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.
  50. [/emember_protected]
  51.  
  52. Section Protection Not For Specific Membership Level
  53. If you want to protect a section and make it NOT visible to a particular membership level then use the following shortcode:
  54. [emember_protected not_for="1" do_not_show_restricted_msg="1"]
  55. Whatever content goes here is NOT visible to members of membership level 1. All the other members can see this content.
  56. [/emember_protected]
  57.  
  58. Using a Custom Message for the Non Members
  59. This section protection shortcode can take another extra optional argument which can help you customize the text/message that is shown to non members.
  60. Here is an example usage:
  61. [emember_protected for="2-3-4" custom_msg='This is a custom message']
  62. The content goes here. this content will be hidden and only available to members of membership level 2, 3 or 4.
  63. [/emember_protected]
  64.  
  65. Section Protection Custom Message with HTML Link
  66. 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.
  67.  
  68. Here is an example shortcode usage:
  69. [emember_protected for="2-3-4" custom_msg='This is a <a href="http://www.example.com">test link</a>']
  70. The content goes here. this content will be hidden and only available to members of membership level 2, 3 or 4.
  71. [/emember_protected]
  72.  
  73. Note
  74.  
  75. 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).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement