evanmcd Posted December 12, 2011 Posted December 12, 2011 Hi, I'm creating a number of pages via the API, all of which will need to be kept unpublished until later review. Is there a way to do this via the API? I haven't seen a property of the Page class that looks like it would do the trick. Thanks.
ryan Posted December 12, 2011 Posted December 12, 2011 Here's how to do it: $page->addStatus(Page::statusUnpublished); Note that $page->status is a bitmask, so it can contain several different statuses at once (for instance, hidden and unpublished). It can be set directly. But because bitwise arithmetic isn't always fresh on my mind, I think it's safer and easier to use $page->addStatus() and $page->removeStatus() for dealing with it.
slkwrm Posted December 13, 2011 Posted December 13, 2011 I think this snippet should be added to the Soma's cheat sheet. Which is, btw, great!
Soma Posted December 13, 2011 Posted December 13, 2011 I think this snippet should be added to the Soma's cheat sheet. Which is, btw, great! It's there already
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now