Jump to content

JkPublishPages - Module to publish/unpublish, trash/delete or move a page depending on dates and times


Recommended Posts

This is a reissue of a module of mine called "PublishingOptions", that I wrote a while ago. The big difference is that this module is written in PHP 8 and has some nice additional features. 

The old module could only publish and unpublish pages depending on date and time settings, but the new version goes much further. So you can decide what should happen after the publication end date has been reached. You have the following options:

  • Unpublish the page - this is what the old version did
  • Move the page to trash - new
  • Delete the page permanently- new
  • Move the page to a new position in the page tree - new

The last option will be interesting if you want to move the page fe to an archive after a certain date. You can select the new parent page and after the publication end date has been reached, the page will be moved under the new parent page.

move.thumb.png.eeddf1ffb17e212b1f5e59d69f985ad3.png

You will find a more detailed instruction and download possibility at https://github.com/juergenweb/JkPublishPages

This module is Alpha stage and should be tested carefully before using it on live sites. I have planned to add this module to the PW module download section, so everyone is invited to test it out and to report issues directly at GitHub.

Thanx

 

 

  • Like 7
  • Thanks 1
Link to comment
Share on other sites

Glad to hear that! 😀

Let me know, if you discover any issues. I will add this as soon as possible to the ProcessWire module directory, but as written, it needs to be tested first by several people.

  • Like 1
Link to comment
Share on other sites

No, it should work with 8.0, but not below.

I have not checked it directly on my local server, but PHP-Storm does not complain after changing the version. I have changed the version on GitHub too, but you do not need to download it again.

Please let me know, if something unexpected occurs, but I guess it will not....

BTW: In the module configuration settings set the CronJob interval to 1 minute for testing purposes, so you can check the functionality immediately. Later on, setting the value to 1 hour again, will be enough.

Best regards

  • Like 1
Link to comment
Share on other sites

BTW: You will get also a notice that your system does not fulfill the requirements if you have not installed LazyCron (not only if the PHP version is lower). You can ignore this, because LazyCron will be installed automatically during the module installation, if it is not installed. Unfortunately, Processwire gives you a warning that your system does not fulfill the requirements for the module, but not exactly what the problem is. 😔

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I have installed the module.

On the module settings page in the "Add fields to template" checkbox-list some of my templates are missing (where I need to add the field). Does the module kind of "sort out" some templates depending on the settings here?

Am I able to add the required fields "by hand" in the template settings instead?

  • Like 1
Link to comment
Share on other sites

Hello Stefanowitsch,

you are right - this is exactly what it does. If you need a certain page to be selectable, you have to make some adjustments in the appropriate page template and sometimes in the template of the parent too.

I recommend you to take a look at both template settings (current page template and parent page template) - in one or in both must be some restrictions set. If you need help, you can post a screenshots of both template settings here, and I will try to figure out the responsible setting.

1 hour ago, Stefanowitsch said:

Am I able to add the required fields "by hand" in the template settings instead?

This would not help you, because, apart from this module, ProcessWire does not let you choose and store a parent page, which will be not be allowed to be a parent page according to your template settings.😉

 

Link to comment
Share on other sites

3 minutes ago, Juergen said:

Hello Stefanowitsch,

you are right - this is exactly what it does. If you need a certain page to be selectable, you have to make some adjustments in the appropriate page template and sometimes in the template of the parent too.

I recommend you to take a look at both template settings (current page template and parent page template) - in one or in both must be some restrictions set. If you need help, you can post a screenshots of both template settings here, and I will try to figure out the responsible setting

You are right. This setting here in the page template settings seems to be responsible for including/excluding the template in the module settings. This was set to "NO" in my case:

May pages using this template have children?

image.png.67115bbcb0bd5f1e1bdc68eab2eddbfa.png

Is this critical for the module to work? I want to include the "Published From" field to a blog post template. This template should not be allowed to have subpages underneath it.

  • Like 1
Link to comment
Share on other sites

My explanation, was for the parent pages, not for adding the publishing fields to the template. To clearify: This blog post template will not be visible at the checkboxes list for the templates in your case?

I will take a closer look on my local installation and give you a feed back after lunch. I guess there will be a problem in querying templates.

  • Like 1
Link to comment
Share on other sites

8 minutes ago, Juergen said:

My explanation, was for the parent pages, not for adding the publishing fields to the template. To clearify: This blog post template will not be visible at the checkboxes list for the templates in your case?

I will take a closer look on my local installation and give you a feed back after lunch. I guess there will be a problem in querying templates.

I'll send you a PM with some screenshots of my page structure and the settings.

  • Like 1
Link to comment
Share on other sites

Hello @Stefanowitsch

There was a wrong query string inside the method, which is responsible to find all frontend templates. I have corrected it on Github. You do not need to download and install the whole module. Please replace the file JkPublishPages.module from the module with the new one at Github and let me know, if it works now. I have bumped up the module version too, because this was a significant malfunction.

BTW: you can set the child settings to no again and only to mention: the homepage is excluded from the templates.

  • Like 1
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

  • Recently Browsing   0 members

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