Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

Simple Membership and categories

Simple Membership Plugin › Forums › Simple Membership Plugin › Simple Membership and categories

Tagged: categories

  • This topic has 4 replies, 3 voices, and was last updated 9 years, 5 months ago by admin.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • May 29, 2017 at 1:43 pm #11067
    ektal12
    Participant

    Sorry if this is a stupid question but …

    How do I check if a user can read a category? I can see how to check if user can read a post from your documentation …

    Thanks very much!

    May 29, 2017 at 10:34 pm #11071
    mbrsolution
    Moderator

    Hi, please read the following documentation.

    Let me know if this helps you.

    Kind regards

    May 30, 2017 at 4:26 pm #11081
    ektal12
    Participant

    Thanks v very much – I read this already … I’m trying to include a check on categories in a template I’m writing … something like:

    $access_ctrl = SwpmAccessControl::get_instance();
    if ($access_ctrl->can_i_read_category($category)){
    //do something
    }

    I want to test if a user can read a particular category rather than can read a particular post. Is that clear now?

    Thanks
    Laurence

    May 30, 2017 at 10:07 pm #11084
    mbrsolution
    Moderator

    Thank you for clarifying your question further. The plugin developers will investigate further your request.

    Kind regards

    May 31, 2017 at 3:59 am #11088
    admin
    Keymaster

    I don’t think we have a function for exactly waht you are after. The can_i_read_post() function will consider everything that needs to be considered (including the category that is assigned to the post) and then return true if all those checks succeed.

    We do have another function that can tell you if the post belongs to a category that the current user has access to or not.

    
    $permission = SwpmPermission::get_instance($auth->get('membership_level'));
    if($permission->is_post_in_permitted_category($post_id) || $permission->is_post_in_permitted_parent_category($post_id)) {
        //This post belongs to a category that this user has access to.
    }
    
  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy