- This topic has 5 replies, 2 voices, and was last updated 9 years, 9 months ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.
WordPress Membership Plugin
Simple Membership Plugin › Forums › Simple Membership Plugin › Adding protection via API call
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!)
Hi, have you tried the following addon?
https://simple-membership-plugin.com/simple-membership-addon-better-custom-post-type-protection/
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();
Hi, have a look at the following documentation. At the end there is a function that might help with your code above.
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
Hi, I have submitted a message to the developers to investigate further your request.
Thank you