We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16083
    • 28 Posts
    I am having a few problems with the published on dates. Firstly, I am using the published date for my Ditto snippet, so it needs to be correct.

    If I create a new document, add some content, save it and right-click in the menu and select publish, it gets published fine, however no date or time gets set into the published on field, so Ditto assumes a date some time in 1969. The field is just left blank. If I then go and manually set the published on date, it is correctly set into the field, but as my local time is several hours ahead of my server time, it is only ’scheduled’ for future publication. Okay, that’s fair enough as I can change the Server Offset time. If I do this and then set up the current publish time, I get the following error (which has been reported before):

    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `gamesfac_modx`.modx_site_content.pub_date < 1154540781 AND `gamesfac_modx' at line 1 »
          SQL: UPDATE `gamesfac_modx`.modx_site_content SET published=1, publishedon=1154515581, publishedby= WHERE `gamesfac_modx`.modx_site_content.pub_date < 1154540781 AND `gamesfac_modx`.modx_site_content.pub_date!=0
    


    I *can* get it to work as expected by leaving the server offset set to 7 and manually subtracting 7 from my local time when setting the published on date. The problem with this is it looks like I’m publishing all of my news in the middle of the night.
      • 21255
      • 215 Posts
      When and where exactly does the error occur? Which version of MODx do you use?
        • 16083
        • 28 Posts
        I’m using version 0.9.2.1 (rev 1005).

        Here’s what I need to do to get the error to occur:

        • Create a new document with any content, anywhere in my site hierarchy
        • Right-click on the document in the treeview and hit ’publish’
        • Select the document from the treeview and hit ’edit’
        • Look at the publish date and note that it is empty
        • Click the little calendar icon next to the publish date, and select todays date from the popup
        • Save the document

        At this point, the error is emitted whenever the page is viewed. Note, this problem seems to be specific to having a positive time-difference between servertime and localtime. My server is 7 hours behind my localtime.

        Hope this helps.
          • 25663 MODX Staff
          • 12,272 Posts
          Thanks for the very solid description of this bug kneehat; tremendously helpful in figuring it out and getting it fixed for the next release. Speaking of which, could you please file this as a bug report in our bugtracker so we can make sure to not loose track?

          However, it would be even more helpful if you could check the current SVN repository to see if this bug still exists. It contains some logic changes to publish dates/by/author. I’ll be happy to forward you a link to a very recent test build if you’d like (via PM).
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 16083
            • 28 Posts
            Ryan,

            Not a problem at all. I’ll go and enter a bug right now.

            I don’t want to test the latest SVN version on my production site for obvious reasons but I’m sure I can replicate it on my test server. I’ll just have to play around with the clock a little, so if you let me have the details for getting hold of it, I’ll give it a spin.
              • 25663 MODX Staff
              • 12,272 Posts
              PM sent. Thanks for testing indeed. I’m leaning towards saying that the current trunk fixes the problem.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 16083
                • 28 Posts
                Okay, I tried a totally fresh install of the latest code. Unfortunately, both problems still exist. The publish date is not filled in when publishing and if set manually to the ’correct’ time, the MySQL error occurs.
                  • 22815
                  • 1,097 Posts
                  There are two parts here:

                  1) Publish date not set when you publish a document
                  - that’s by design. Publishing a document removes all publication dates. Yes, it is confusing.
                  2) Some SQL error, somewhere
                  - I can’t replicate this with RC2

                  I know it is some time since you posted this, but I’m trying to trim the bugs slated for fixing in 0.9.5. If you haven’t already worked something out, I think your best action is to use your own TV for the date displayed.
                    No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
                    MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
                    Forum: Where to post threads about add-ons | Forum Rules
                    Like MODx? donate (and/or share your resources)
                    Like me? See my Amazon wishlist
                    MODx "Most Promising CMS" - so appropriate!
                    • 14557
                    • 48 Posts
                    I also had the original SQL problem with publish dates described in this thread. I have a number of news articles which are displayed in descending date order based on the publication date. In 0.9.2.1 if I added a news article, selected the publish date using the calendar control as today, checked published and pressed save then the site would no longer load, with the described SQL error.

                    I can confirm that this crash no longer happens in 0.9.5, although the behaviour still seems a bit odd. What happens in 0.9.5 is that although I ticked the Published box before saving, the document saves as unpublished, presumably because the server time is slighly behind my local machine time so percieves that the document is not yet published. I suppose its not really a bug, but it makes my use of publication date a little more fiddly than it ought to be.

                    John