We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 35549
    • 24 Posts
    Hi

    I have problems with creating resources using the 'resource/create' processor when Articles is installed. Each time I try to use $modx->runProcessor I get PHP fatal error: 'Cannot redeclare class modResourceCreateProcessor in /var/www/modx-2.2.0-pl2/core/model/modx/processors/resource/create.class.php on line 606 (...)'
    Only after uninstalling Articles, it works again.

    Here is an example snippet that I used for testing:
    $fields = array('pagetitle' => 'test', 'content' => 'this is a test resource');
    $response = $modx->runProcessor('resource/create',$fields);
    if ($response->isError()) {
        return $response->getMessage();
    }



    Is it possible that I am doing something wrong? I assume that this has to do with the fact that the processor is overridden by Articles.

    Thanks a lot in advance!
      • 28215
      • 4,149 Posts
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 35549
        • 24 Posts
        Done here: http://bugs.modx.com/issues/6593
        Thanks again!
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          Confirmed the same behavior in HandyMan - latest from Git doesn't seem to fix the problem either.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 23299
            • 1,161 Posts
            I am also getting this when attempting to post from the front end via NewsPublisher? [ed. note: Photowebmax last edited this post 14 years, 7 months ago.]
              • 18373 ☆ A M B ☆
              • 3,141 Posts
              Not aware of the actual code being used with NewsPublsiher, but I bet it also uses runProcessor!

              Related bug reports:

              http://tracker.modx.com/issues/7279
              http://tracker.modx.com/issues/7274
              http://tracker.modx.com/issues/6916
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                • 23299
                • 1,161 Posts
                I have several sites messing around with both Articles and Newspublisher.

                I am really exploring NewsPublisher with a private hidden Post page that can be accessed with the Login snippet. NewsPublisher is a good option for small community sites were you want members to create content posts from the front end only.

                On one site I had installed Articles and NewsPublisher. I did not do anything with Articles though, but did present NewsPublisher on a getResources container page. I then tested a NewsPublisher post but got that fatal error upon hitting submit. I did a lot of checking with my building blocks as I have a lot of moving parts but still got the error. I then uninstalled Articles completely and the error went away when using the NewsPublisher form. I think this is a bug in Articles?


                Hope this helps...
                  • 3749
                  • 24,544 Posts
                  It's quite a mystery. It happens even with a simple test snippet calling resource/create or resource/update. It happens even if the Articles plugin is disabled, so I can't imagine what's doing it, but it disappears as soon as you uninstall Articles. Shaun is looking into it and hopefully we'll have a fix soon.


                  ---------------------------------------------------------------------------------------------------------------
                  PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
                  MODX info for everyone: http://bobsguides.com/modx.html
                    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
                    • 23299
                    • 1,161 Posts
                    Interesting...

                    To help recognize the error message it looks like this:

                    Fatal error: Cannot redeclare class modResourceCreateProcessor in /home/ownerName/public_html/siteName/core/model/modx/processors/resource/create.class.php on line 606
                      • 3749
                      • 24,544 Posts
                      Unfortunately, the error is not there but somewhere else. If the resource/create processor has already been instantiated, that file shouldn't be "included" but obviously it is. So somewhere, MODX is getting confused about which processors have already been instantiated.


                      ---------------------------------------------------------------------------------------------------------------
                      PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
                      MODX info for everyone: http://bobsguides.com/modx.html
                        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