Mirza Posted July 25, 2017 Posted July 25, 2017 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.
Sergio Posted July 25, 2017 Posted July 25, 2017 You probably set your publish_date field to automatically set a default date (NOW()) on page save.
Mirza Posted July 25, 2017 Author Posted July 25, 2017 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.
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