Jump to content

Default Page Status created from API


Mirza
 Share

Recommended Posts

Hi All,

I have created a script which will create the pages and it should be unpublished.

I have added the status as unpublished by default while first time saving the page as below.

$hotelPage->hotel_website = $hotel['hotelWebsite'];

// By default page created will be unpublished state
$hotelPage->addStatus(Page::statusUnpublished);
$hotelPage->save();
$hotelPage->setOutputFormatting(false);
// Add hotel images only after setting output formatting to false
$hotelPage->images->add($hotel['hotelImage']);
$hotelPage->save();

On the same time, saving the hotel image as well and triggering the save method.

But when I see the created page in the tree, Its shows unpublished but publish_date is not empty(date will be present as created, modified and published are all same)

Now I don't understand why the date is getting filled into the publish field for a page?

Please let me know if am doing something wrong.

Link to comment
Share on other sites

10 minutes ago, Sérgio Jardim said:

You probably set your publish_date field to automatically set a default date (NOW()) on page save.  

I have not set any value to the publish field on page save, I do checked the pages table schema which has default null value.

Might be any module which has a hook will be affecting, Let me give a try.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...