Support » Plugin: Simple Membership » Restrict Custom Post Type

  • Resolved awesiome

    (@awesiome)


    Hello,

    Your plugin is amazing. I appreciate the tremendous effort and I left a great rating. I would like some help with restricting a post type. You have options for restricting posts, pages, and categories. But I would like to restrict a custom post type to a specific membership level. May you please help me with perhaps a function that I can insert in my functions.php file?

    Let’s say the custom post is called “invoices” and the membership level I want to have access is called “Staff”. Could you provide a function that restricts access of the invoices post type to only Staff members?

    I think it makes it a bit simpler, that all custom post type posts have a base in the permalink structure. So using the invoices post type the base would be of this sort: http://www.mywebsitename.com/invoices/%5Bpost name here]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Hi, thank you for your nice words 🙂

    In regards to your question, have you tried creating a membership level named staff? Then only assigned the members you want to this level? That way when they land on the Invoice page only those who are assigned to staff level can view the content.

    Does the above make sense?

    Regards

    Thread Starter awesiome

    (@awesiome)

    Hi,

    That makes perfect sense. However, I am talking about a custom post type. Not just a single post. So I have indeed created the membership level but I cannot restrict access because there are many posts in that post type and more are created each day therefore manually restricting each individual post becomes hard.

    Plugin Support mbrsolution

    (@mbrsolution)

    Hi, try the following addon. Let me know if this helps you.

    Regards

    Thread Starter awesiome

    (@awesiome)

    I have tried the add-on but I did not have a problem with protecting individual custom posts. The plugin on it’s own can be used to protect each individual custom post without the need for an add-on. What I need is to protect the entire post type. So for instance if I have a custom post type called portfolio with say 100 posts how to I protect the entire portfolio post type instead of going into each individual post and manually changing it.

    I could put all posts of the custom post type in a specific category and then use the plugin to restrict the category. But I would still have to add each individual post to the new category. New posts would not be added automatically. Changing the default WordPress post category only works for native WordPress post types and not custom posts.

    For now I have decided to display all the posts in a grid on certain page and restrict the page itself to a membership level. I have also gone ahead to make the posts not publicly queryable anyway. So they can only be seen in the post grid section on that specific page.

    But making it possible to restrict entire post types would be good for future versions of the plugin.

    Thank you for responding to my questions 🙂

    Plugin Support mbrsolution

    (@mbrsolution)

    Hi, I understand what you mean. However at present the plugin does not protect that type of custom blog page. I have submitted a message to the developers to investigate further your issue.

    Kind regards

    Thread Starter awesiome

    (@awesiome)

    Thanks

    Plugin Author wp.insider

    (@wpinsider-1)

    I will look at adding an option for it in the future.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Restrict Custom Post Type’ is closed to new replies.