Michael van Laar Posted August 12, 2015 Share Posted August 12, 2015 Hm, I just realize that I can only check if a page is saved as “unpublished”. But I can’t catch that moment when a published page is saved for the first time with the “Unpublished: Not visible on site” checkbox checked, so that the page is now unpublished. Or can I? If I add the rule I thought of (see below), this would mean that saving an unpublished page – whether it has ever been published or not – with a publish_from date which is older than the current timestamp. if ($page->is(Page::statusUnpublished) && $page->template->hasField('publish_from') && $page->publish_from < $currenttime) { $this->session->error($this->_("“Publish From Date” field was cleared because it contained a date which lies in the past. This would have caused the page to be (unintentionally) published resp. re-published on the next Lazy Cron run. Obviously this was not your intention since you chose to only save and not publish the page.")); $page->publish_from = null; $page->save('publish_from'); } As a consequence a user would no longer be able to save a new page as “unpublished” with a publish_from date which lies in the past. Comparison: With the current version of the module this new and unpublished page will be published resp. re-published on the next cron run. With the additional code above the publish_from field is cleared, the page will thus remain unpublished and an error message informs the user about what happend. I think this behavior is more logical than the current one. But it definitely changes the way the module handles publishing dates from the past on unpublished pages. So if some users rely on the present behavior as part of their workflow, they would have a bit of a problem. Link to comment Share on other sites More sharing options...
LostKobrakai Posted August 12, 2015 Share Posted August 12, 2015 Maybe like this: $page->isChanged("status") && $page->is(Page::statusUnpublished); Link to comment Share on other sites More sharing options...
Michael van Laar Posted August 12, 2015 Share Posted August 12, 2015 Maybe like this: $page->isChanged("status") && $page->is(Page::statusUnpublished); Thank you! That’s it. I should read the cheat sheet more conscientiously. In combination with adding an additional hook before the $pages->save it works like a charm. Pull request for module version 1.2.1 is already out: https://github.com/formmailer/SchedulePages/pull/9 1 Link to comment Share on other sites More sharing options...
formmailer Posted August 13, 2015 Author Share Posted August 13, 2015 Great work! Just merged the request... Link to comment Share on other sites More sharing options...
ceberlin Posted December 7, 2015 Share Posted December 7, 2015 I wondered why the module wasn't working on included pages (like tablefield pages). I thought this to be a bug, it's not. The module actually works! - What actually was the problem was: The find section for identifying the pages which need work could include an "include=hidden". So all the hidden pages also benefit from this great feature. - Endless possibilities! UPDATE: Forget this message: Adding include=hidden makes no difference. I simply had a problem with my cache. Sorry. Is scheduler honoring the ProCache on status changes? Link to comment Share on other sites More sharing options...
apeisa Posted December 7, 2015 Share Posted December 7, 2015 What you mean by honoring ProCache? Link to comment Share on other sites More sharing options...
LostKobrakai Posted December 7, 2015 Share Posted December 7, 2015 ProCache does skip PHP all together and goes directly from htaccess to the cached html, therefore it doesn't honor anything, if you do not set it up to reset the cache properly on the needed status changes. Link to comment Share on other sites More sharing options...
Chris Posted January 22, 2016 Share Posted January 22, 2016 I have the following issue, with PW 2.7.2 and the current SchedulePages Version: when using the datepicker, it outputs "hh" and "ss" string, which ovisously causes errors, when one publishes the page Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 22, 2016 Share Posted January 22, 2016 The modules does use standard datetime fields, therefore if other datetime fields do suffer from the same issue it's probably a core issue. 1 Link to comment Share on other sites More sharing options...
Chris Posted January 28, 2016 Share Posted January 28, 2016 The modules does use standard datetime fields, therefore if other datetime fields do suffer from the same issue it's probably a core issue. Here's what solved the problem for me. Left page original settings of the auto generated publish fields, right page are my modification of the settings. no more "hh" and "ss" strings and the page scheduling works now so maybe for some reasons time formating options that need to be choosen was missed by the auto generated post_from/post_until fields, which i did'nt touched since creation. 3 Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 28, 2016 Share Posted January 28, 2016 This module is already sticking around for some time, so probably it got never updated to use separate Date and Time format strings. Link to comment Share on other sites More sharing options...
formmailer Posted January 28, 2016 Author Share Posted January 28, 2016 I'll try to look into this as soon as possible, but if someone already fixed it and can submit a merge request it would be a great help. //Jasper 2 Link to comment Share on other sites More sharing options...
Marco Angeli Posted January 29, 2016 Share Posted January 29, 2016 I can confirm that Chris workaround saved my life. Thanks Chris for your suggestion and thanks formmailer for this useful module! 1 Link to comment Share on other sites More sharing options...
chuguruk Posted May 20, 2016 Share Posted May 20, 2016 I have tried to install this module on PW 3.0.17 - it doesn't want to install. Asks for "LazyCron" which is istalled (core). Any chances for an update? I had to install LazyCron manually and it works now - sorry! Link to comment Share on other sites More sharing options...
ceberlin Posted October 27, 2016 Share Posted October 27, 2016 I found a conflict with PW 3: I could not duplicate a page from the page tree. Messages on page tree page (default Admin): Maybe some checks about the publishing should be left out when a page is just beeing duplicated. I.m.h.o the publish_from and publish_until fields should be simply cleared for the fresh duplicate (even if required)? (Or is this something I need to report as PW issue?) Link to comment Share on other sites More sharing options...
teppo Posted October 27, 2016 Share Posted October 27, 2016 Looks like I have made the following patch locally: - if ($page->isChanged('status') && $page->is(Page::statusUnpublished) && $page->publish_from) { + if (!$page->isNew() && $page->isChanged('status') && $page->is(Page::statusUnpublished) && $page->publish_from) { Possibly related 3 Link to comment Share on other sites More sharing options...
ceberlin Posted October 27, 2016 Share Posted October 27, 2016 @teppo thanks a lot !!!!!!!! - that fixed the problem! @formmailer Can this feature be included in the module maybe? (easier to maintain) 1 Link to comment Share on other sites More sharing options...
formmailer Posted October 28, 2016 Author Share Posted October 28, 2016 22 hours ago, ceberlin said: @formmailer Can this feature be included in the module maybe? (easier to maintain) This fix is now included into the module. Thanks @teppo and @ceberlin. //Jasper 2 Link to comment Share on other sites More sharing options...
neophron Posted April 7, 2020 Share Posted April 7, 2020 On 1/28/2016 at 10:50 AM, Chris said: Here's what solved the problem for me. Left page original settings of the auto generated publish fields, right page are my modification of the settings. no more "hh" and "ss" strings and the page scheduling works now so maybe for some reasons time formating options that need to be choosen was missed by the auto generated post_from/post_until fields, which i did'nt touched since creation. Thanks for this. I want to show this error for better search results: WireDateTime: The parsed time was invalid 1 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