fbpx
  1. Home
  2. Knowledge Base
  3. Tips, Tricks and Customizations
  4. Customize MemberMouse
  5. Protect Content on Category or Blog WordPress Template Pages
  1. Home
  2. Knowledge Base
  3. FAQ
  4. WordPress FAQ
  5. Protect Content on Category or Blog WordPress Template Pages
  1. Home
  2. Knowledge Base
  3. FAQ
  4. Content Protection FAQ
  5. Protect Content on Category or Blog WordPress Template Pages

Protect Content on Category or Blog WordPress Template Pages

MemberMouse provides several different ways to show or hide content based on the currently logged in member's access rights. You can protect pages/posts, RSS feeds, search results, archives and even specific portions of a page/post using a Decision SmartTag.

However, some areas of your WordPress site are created via a template page.  Templates are the files which control how your WordPress site will be displayed on the Web. These files draw information from your WordPress MySQL database and generate the HTML code which is sent to the web browser, and can include things like category pages, blog pages, tag pages and more. Read this article to learn more about WP templates.

MemberMouse does give you the ability to show an excerpt of your post on these pages using the <!–more–> tag. Read this article to learn how to protect post excerpts.  If you are looking to protect the entire page, you can follow these steps:

  • Find the archive or template page that your theme uses for that page (this article will show you how)

  • At the top of your template page, add this

    codeif(mm_member_decision(array("isMember"=>"false")) || mm_member_decision(array("membershipId"=>"1")))
    {
       wp_redirect("http://www.URL.com/mm-error/?code=100020");
    }


  • In the code above,  anyone who is not a member (or is not logged in), or is a member level of ID1 (usually the free membership, but you will want to check by finding your membership level IDs) will get the error page as well.

  • This code is using code similar to the Member_Decision SmartTag. You can adjust it to protect the template based on information associated with the currently logged in member. Read this article to learn more about Member_Decision SmartTags.
Was this article helpful?

Related Articles

Can’t find the answer you’re looking for?

Reach out to our Customer Success Team
Contact us!