evanmcd Posted December 12, 2011 Share 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. Link to comment Share on other sites More sharing options...
ryan Posted December 12, 2011 Share 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. Link to comment Share on other sites More sharing options...
evanmcd Posted December 12, 2011 Author Share Posted December 12, 2011 Works great. Thanks so much Link to comment Share on other sites More sharing options...
slkwrm Posted December 13, 2011 Share Posted December 13, 2011 I think this snippet should be added to the Soma's cheat sheet. Which is, btw, great! Link to comment Share on other sites More sharing options...
Soma Posted December 13, 2011 Share 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 Link to comment Share on other sites More sharing options...
slkwrm Posted December 13, 2011 Share Posted December 13, 2011 Wow! It grows so fast. Great work, Soma Link to comment Share on other sites More sharing options...
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