How to set Post Level Restriction via php?

We are creating pages dynamically via PHP/MySQL. How can we set the Post Level Restriction via PHP?

I don’t know the direct answer to your question, but if your Pages have a coherent URI structure, you could use URI Restrictions.

THanks Pat, but we are aware of the many restrictions URI, category that can be applied generally.

What we really need to to be able to apply restrictions to a post when we create it via PHP.

You must dig in code… Find where s2M saves the restrictions, this will show you how to do it.

1 Like

krumch - If I wanted to dig into the code, I would already have done it. I chose to ask first for 2 reasons. 1) Digging in the code and testing is very time consuming. 2) even more important, it does not always yield a sustainable solution. If there is a documented or recommended method or function, we would like to use that.

So please, if you have an answer please share it. I mean no offense but if you do not know the answer, please either say “I do not know” or even better, say nothing.

Sonja, what basis are you using to protect posts: category, tag, URI, post type … ? There must be some generic basis in order to automate this.

1 Like

You create a custom solution - virtual pages. You know that they are not covered by s2M “out of the box”. What is the best way to do a “custom protection”?

If you want me to dig into the code for you, please PM me.

Business rules, like $ amounts.

Based on what data available to s2Member?