Jump to content

"published" and "modified" always have the same value


Marcel Stäheli
 Share

Recommended Posts

I'm trying to create a news page. I ran into a problem with the sorting of the pages that are being displayed. I want to sort them by publishing date and it works, but whenever I edit one of the pages, the published and modified values get set to the new date and because of that the sorting order changes.

Is this a bug? Do I have to activate something so the the publishing date stays unchanged?

Link to comment
Share on other sites

I tested and cannot reproduce. For published pages, editing and saving a page updates the modified timestamp but not the published timestamp.

But for news pages I think it is more typical to add a datetime field to the template to serve as the posting date, so the user can change the date to suit. For instance, to set a future posting date and then in your news selector you exclude pages with posting date greater than today.

  • Like 4
Link to comment
Share on other sites

21 hours ago, Robin S said:

add a datetime field to the template

+1

I would not rely on system internal values for such a thing since you should let your editors decide what date to pick, and they should not change system internal values whatever they may be.
BTW, I often push it a bit further and create an "Event Date" too, to signal when a particular event took place (if appropriate, of course, so such a field is optional).

  • Like 1
Link to comment
Share on other sites

Thank you both for your reply. 

I tried it on a fresh installation of processwire and it worked fine as you stated. So it had to be something specific  in my project. It couldn't be my templates, I never did anything with the modified and published values besides echoing them. So I had a look at my installed modules. And it turned out that some of them used those values.

The module "batch child editor" had the most hits when I searched for the term "published" and after I uninstalled it and edited one of the articles, the two values were diffrent. So I assume something in that modules overwrites the published value every time I edit a page (I never edited those particular articles via that module).

I either configurated it wrong (I haven't seen any option that could explain this behaviour though) or it is a bug in the module. I contacted the autor of the module, so he can check it out just in case.

I will probably still add a custom date field to be more flexible, thanks for the input.

  • 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...