Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

I think this snippet should be added to the Soma's cheat sheet. Which is, btw, great!

It's there already :D

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...