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

Adding protection via API call

Simple Membership Plugin › Forums › Simple Membership Plugin › Adding protection via API call

Tagged: api, protect

  • This topic has 5 replies, 2 voices, and was last updated 9 years, 9 months ago by mbrsolution.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • August 3, 2016 at 8:44 am #7702
    robertiles
    Participant

    Hi

    Is there a way to add protection to a post using a system call or some other programmatic technique. I push custom posts into a system from PHP and want them to be protected … something along the lines of (made up call!)

    SwpmMemberUtils::protect(get_post_id(), array($memberlevel));

    If not, how can I add this as I can’t find swpm meta data in the db to see how to fake it (would MUCH rather use a built-in function!)

    August 3, 2016 at 9:27 am #7704
    mbrsolution
    Moderator

    Hi, have you tried the following addon?

    https://simple-membership-plugin.com/simple-membership-addon-better-custom-post-type-protection/

    August 3, 2016 at 9:36 am #7705
    robertiles
    Participant

    Yes, I have tried that, it still requires the editor to remember to set the protection for the post and for any attachments … I need something that forces the protection on certain custom data types

    This will seem to do it but not sure how to set the level (it will pick up the level if you are logged in at that level but I need to be able to set the access level explicitly)

    SwpmProtection::get_instance()->add_custom_posts($ids)->save();

    August 3, 2016 at 10:18 am #7706
    mbrsolution
    Moderator

    Hi, have a look at the following documentation. At the end there is a function that might help with your code above.

    August 3, 2016 at 10:33 am #7707
    robertiles
    Participant

    If I recoded all of the content and archive pages for the custom type then I could use this – but then I wouldn’t need teh “protect” admin panel for those custom types … It would be easier to add a function to the “after post update” hook that forced the correct permissions in a compatible way

    August 3, 2016 at 10:46 am #7708
    mbrsolution
    Moderator

    Hi, I have submitted a message to the developers to investigate further your request.

    Thank you

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 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