We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24374
    • 322 Posts
    Quote from: BobRay at Jan 23, 2014, 10:14 PM
    Yes, it definitely has trouble with Articles when it's disabled. wink
    Did something change? I seem to remember this working in Articles, but I have a site running MODX 2.2.14, Articles 1.7.6, and StageCoach 1.4.0. StageCoaching a regular resource works fine, but doing it to an article creates the staged resource in the database, with class_key "Article", all the correct data, and the right parent ID (the Staged Resources folder), but it doesn't show up in the tree in the Staged Resources folder. The problem seems to be that "show_in_tree" is set to 0, like it is for all Articles. Stagecoach should set this to 1 for staged resources, and set it back to 0 if it's an article that gets pushed live, unless there is some other way to force resources to show up in the tree under a given parent. [ed. note: rainbowtiger last edited this post 9 years, 8 months ago.]
      • 3749
      • 24,544 Posts
      You could change this code around line 315 of the StageCoach plugin:

      /* duplicate and save the staged Resource */
        $stagedResource = $resource->duplicate($params);
        $stagedResource->save();


      to this:

      /* duplicate and save the staged Resource */
         $stagedResource = $resource->duplicate($params);
         if ($stagedResource->get('class_key') == 'Article') {
             $stagedResource->set('show_in_tree', true);
         }
         $stagedResource->save();


      I'm pretty sure, though, that when you hit the stage date, the real article will show in the tree. I think you could fix that by changing this code around line 190:

      $success = $originalResource->save(0);


      to this:

      if ($originalResource->get('class_key') == 'Article') {
          $originalResource->set('show_in_tree', false);
      }
      $success = $originalResource->save(0);


      Let me know if it works. If it does, I'll add it to the next release.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 24374
        • 322 Posts
        Hi.

        Well, the article shows up in the tree now, but when you click on it you get this message:

        Fatal error: Call to undefined method modDocument_mysql::getContainerSettings() in /home/mhc1/public_html/core/components/articles/model/articles/article.class.php on line 76

        So, the page is trying to load settings from its parent, which isn't the Articles container any more, and things are going wrong.
          • 3749
          • 24,544 Posts
          Ouch. I don't see any easy way around that. I think it would take extensive changes to the code of the Articles Extra.

          You might try setting the stagecoach_resource_id System Setting to the ID of your Articles container. It could work.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting