We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34193
    • 330 Posts
    $output['loginRes'] = $modx->runProcessor('security/login', array(
                    'username' => 'fred', /*$username*/
                    'password' => 'jhfdsksdj' /*$password */
                ));
    


    MODx Revolution 2.0.8-pl (traditional)

    is there any reason as to why the above is returning

    Fatal error: Call to a member function loadErrorHandler() on a non-object in /home/handswor/public_html/core/model/modx/modx.class.php on line 1440

    I know it is this specific line since if I remove it then the code runs.
      • 34193
      • 330 Posts
      ok solved the above by changing to this
          $output['loginRes'] = $modx->runProcessor('security/login', array(
                      'username' => 'fred', /*$username*/
                      'password' => 'jhfdsksdj' /*$password *//
                  ), array (
                      'processors_path' => '/home/handswor/public_html/core/model/modx/processors'
                  ));
      


      problem is now that $output[’loginRes’] is set to null no matter if the user exists or not so there is no way to determine if the login was successful.

      I should say that I am running this in an external file not a snippet but have this
      require_once '/home/handswor/public_html/config.core.php';
      require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
      require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
      $modx = new modX();
      $modx->initialize('Development');
      

      at the top of the file.
        • 34193
        • 330 Posts
        OK now I’m really confused.... If I run this code in a snippet within the web context it works fine.

        I now know that the user isn’t being logged in when running this externally in a seperate context.

        EDIT also running inside a snippet in the Development context doesn’t work either.
          • 34193
          • 330 Posts
          Forget the second post more digging shows that whilst it doesn’t error out the second way doesn’t even find the processor file so the problem is still the one in the initial post.
            • 6228
            • 249 Posts
              lo9on.com

              MODx Evolution/Revolution | Remote Desktop Training | Development
              • 34193
              • 330 Posts
              cyclissmo your a genius man, many many many thanks.

              Adding

              $modx->getService('error','error.modError');


              solved the issue now I can get on with the rest of it.

              Gonna file bug re the docs I feel this needs adding to doc area on using Modx externally.