We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25663 MODX Staff
    • 12,272 Posts
    jlivingston, am I confused, or is the publishedon and publishedby values still reversed in that file you posted? Also, there was mention of altering something else later on; do we still need to consider that you think?
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 33453
      • 141 Posts
      Quote from: breezer at Jul 12, 2006, 11:00 AM

      The publishedon and publishedby should be set to time() and author upon document creation and stay the same and never change, regardless if the document is edited or by whom it is edited. The original publish date and author should stay so a refernce to when and by whom the document was created is always available.
      Surely this is the function of "createdon" and "createdby"?

      "publishedon" and "publishedby" on should reflect exactly what their names suggest.
        • 14281
        • 120 Posts
        Quote from: rthrash at Jul 12, 2006, 03:56 PM

        jlivingston, am I confused, or is the publishedon and publishedby values still reversed in that file you posted?

        LOL...you caught that, huh? grin Yeah, I noticed that zenmaster said to switch them, but if you look at the query:

        $sql = "INSERT INTO $dbase.".$table_prefix."site_content(introtext,content, pagetitle, longtitle, type, description, alias, isfolder, richtext, published, parent, template, menuindex, searchable, cacheable, createdby, createdon, editedby, editedon, publishedon, publishedby, pub_date, unpub_date, contentType, content_dispo, donthit, menutitle, hidemenu)
        				VALUES('".$introtext."','".$content."', '".$pagetitle."', '".$longtitle."', '".$type."', '".$description."', '".$alias."', '".$isfolder."', '".$richtext."', '".$published."', '".$parent."', '".$template."', '".$menuindex."', '".$searchable."', '".$cacheable."', ".$modx->getLoginUserID().", ".time().", ".$modx->getLoginUserID().", ".time().", ".$publishedon.", ".$publishedby.", $pub_date, $unpub_date, '$contentType', '$contentdispo', '$donthit', '$menutitle', '$hidemenu')";


        You’ll notice that the order in which the values are called matches the order in which they are inserted. I had to do a triple take at this, because zenmaster obviously knows what he’s doing. But I couldn’t see how switching would do anything but mess it up. The main thing that needed to happen was inserting the values for editedby and editedon before the two published settings, so that everything is in sync. I tested it out, both by placing a check mark in the published field and saving, and by right clicking in the document tree and selecting "Publish document" (which I understand doesn’t pertain to this method, but just to be safe). It works as expected; time gets placed in the "publishedon" field, and a user ID gets placed in "publishedby".

        Please do let me know, anyone, if I have missed something. I definitely want it to be right.

        Quote from: rthrash at Jul 12, 2006, 03:56 PM

        Also, there was mention of altering something else later on; do we still need to consider that you think?

        I’m not sure what you’re in reference to, but I’ll go as far as to say that I think the problem that I brought up in this thread has been completely resolved with this fix. I appreciate you being thorough.
          • 25663 MODX Staff
          • 12,272 Posts
          Finally stripped out what I had done and matched them up side by side and I had them reveresed... thanks!
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 33453
            • 141 Posts
            Ha - I did say to switch both labels AND values grin.

            The switch isn’t actually necessary but if you look at the order of the fields they go "... userid, time, userid, time, time, userid ..." and i just thought it would be tidier to have them consistant.

            Sorry to have confused the issue.
              • 14281
              • 120 Posts
              Quote from: zenmaster at Jul 12, 2006, 05:20 PM

              Ha - I did say to switch both labels AND values grin.

              The switch isn’t actually necessary but if you look at the order of the fields they go "... userid, time, userid, time, time, userid ..." and i just thought it would be tidier to have them consistant.

              Sorry to have confused the issue.

              I thought that might be your thinking, and I almost did that. Then I realized that the current order reflected the order of the fields in the database. So it’s a tradeoff either way.
                • 24278
                • 165 Posts
                Hi members,

                I applied the patch provided by "jlivingston" but whenever I set a document to auto-publish by providing the "Publish date" I get the following error when the Publish Date is reached (also the document does not get published)

                « 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 `test-site`.modx_site_content.pub_date < 1152804862 AND `test-site`.modx_s' at line 1 »
                      SQL: UPDATE `test-site`.modx_site_content SET published=1, publishedon=1152804862, publishedby= WHERE `test-site`.modx_site_content.pub_date < 1152804862 AND `test-site`.modx_site_content.pub_date!=0
                      [Copy SQL to ClipBoard]
                 
                Parser timing
                  MySQL: 	0.0152 s s	(0 Requests)
                  PHP: 	0.0418 s s	 
                  Total: 	0.0570 s s
                


                When I checked the database entries for publishedby in the modx_site_content table... the entries are either 1 or 0.

                Please may I have some advice on rectifying the problem

                warm regards,

                Raavi
                  • 14281
                  • 120 Posts
                  Hey Raavi, as far as I can tell, I’m farely positive that your error isn’t connected the issue that was dealt with in this thread. Your error refers to an UPDATE statement, whereas the lines I changed refer to an INSERT statement. I did spend a brief amount of time looking for where your error might have been derived from, but wasn’t able to come to any conclusions. You might consider starting a new thread, and maybe someone more familiar with the structure of the core code can look into your error.