We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • How much work would it take to integrate a forum or a shopping cart in to modx now with the new structure? Sharing usernames and passwords for forums and hidden pages etc.
      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
      AugmentBLU - MODX Partner

      BLUcart - MODX Revolution E-Commerce & Shopping Cart
    • A lot. Note that we don’t even do that here at the MODx site, and it would tremendously benefit the project to do so. We will be able to accomplish this with the 097 branch much more simply though.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • Quote from: rossco at May 01, 2008, 09:05 PM

        How much work would it take to integrate a forum or a shopping cart in to modx now with the new structure? Sharing usernames and passwords for forums and hidden pages etc.
        I think Ryan didn’t notice what board this post was in, but anywho... wink

        Essentially integrating an existing "forum" or "shopping cart" system is something that STILL depends entirely on the capabilities of said system to integrate with external applications. And even that can be a difficult thing to determine; a lot of systems say they provide API’s for these types of integrations, but they often fall short of functional expectations in actual deployments.

        Unfortunately, there simply is not a cookie-cutter approach to integrating the various user systems of disparate PHP web applications. Each application has to be evaluated to determine the best path to take, and in many cases, there aren’t any quick solutions. And I won’t even get into the other issues inherent in developing bridges between applications with "incompatible" licenses.

        All that said, the ease of using the new modX class as a "framework" (i.e. include in external PHP application code), being able to configure contexts with custom session handlers, user classes, etc., and the multitude of other benefits of the new object-oriented API should hopefully help make these integrations easier for developers to achieve.

        And on a related note, I have an integration partially completed with our Atlassian Crowd identity server via it’s SOAP API. It’s very basic at the moment, and not ready for public consumption yet, but is working very well to allow external authentication to MODx via Crowd, including automatic importation of user data. This first example of a MODx Core Extension consists of an authentication plugin, and two classes, a modCrowdUser class that extends the new modUser class, and a modCrowdClient class that provides a PHP SoapClient instance to communicate with the Crowd SOAP API.

        Here is the current plugin, which reveals a new event in 0.9.7, OnUserNotFound...
        <?php
        switch ($modx->event->name) {
            case "OnUserNotFound":
                if (isset($username) && !empty($username)) {
                    $crowdAttributes = array (
                        'url' => isset($crowdUrl) ? $crowdUrl : $modx->config['user.crowd.url'],
                        'application' => isset($crowdApp) ? $crowdApp : $modx->config['user.crowd.application'],
                        'credential' => isset($crowdPwd) ? $crowdPwd : $modx->config['user.crowd.credential']
                    );
                    $modx->addPackage('modx.user.crowd', MODX_CORE_PATH . 'model/');
                    if ($crowd = $modx->getService('crowd', 'modCrowdClient', '', $crowdAttributes)) {
                        $userexists = $crowd->findUsername($username);
                        $user = & $scriptProperties['user'];
                        $user = $modx->newObject('modCrowdUser');
                        $user->set('username', $username);
                        $user->addOne($modx->newObject('modUserProfile'));
                    }
                }
                break;
        
            //Register this event for authentication in all other contexts
            case "OnWebAuthentication":
            //Register this event for manager authentication only
            case "OnManagerAuthentication":
                $authenticated = false;
                if (isset($user) && !empty($user) && isset($password) && !empty($password)) {
                    $crowdAttributes = array (
                        'url' => isset($crowdUrl) ? $crowdUrl : $modx->config['user.crowd.url'],
                        'application' => isset($crowdApp) ? $crowdApp : $modx->config['user.crowd.application'],
                        'credential' => isset($crowdPwd) ? $crowdPwd : $modx->config['user.crowd.credential']
                    );
                    $modx->addPackage('modx.user.crowd', MODX_CORE_PATH . 'model/');
                    if ($crowd = $modx->getService('crowd', 'modCrowdClient', '', $crowdAttributes)) {
                        if ($authenticated = $crowd->authenticate($user->get('username'), $password)) {
                            if ($user->isNew() && is_a($user, 'modCrowdUser') && $modx->config['user.crowd.autoadd']) {
                                if ($userDetails = $crowd->getUser($user->get('username'))) {
                                    $user->modUserProfile->set('fullname', implode(" ", array($userDetails['givenName'], $userDetails['sn'])));
                                    $user->modUserProfile->set('email', $userDetails['mail']);
                                    $user->modUserProfile->set('failed_logins', $userDetails['invalidPasswordAttempts']);
                                    $user->modUserProfile->set('last_login', $userDetails['lastAuthenticated']);
                                    $authenticated = $user->save();
                                }
                            }
                        }
                    }
                }
                $modx->event->_output = $authenticated;
                break;
        }
        ?>

        Lot’s of exciting new possibilities; many still to be revealed. wink
        • Off topic slightly... Being more a designer and a complete novice at scripting, MODx has went from being hard but understandable to being very difficult. I think i’ll leave the hard bits to you till I understand things a little more. Will a test setup of 097 be available for people to browse so we have a working version to help us match up what goes where etc and when will 096 depreciate?

          Thanks to all the team... hopefully I manage to figure things out. grin
            Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
            AugmentBLU - MODX Partner

            BLUcart - MODX Revolution E-Commerce & Shopping Cart
          • Quote from: rossco at May 02, 2008, 07:14 AM

            Off topic slightly... Being more a designer and a complete novice at scripting, MODx has went from being hard but understandable to being very difficult. I think i’ll leave the hard bits to you till I understand things a little more.
            I fail to follow how MODx went from being hard but understandable to very difficult; there is no real dramatic change from a designer’s perspective and if there is, it would be in the other direction (much easier to use). In fact, it’s actually 1000% easier to accomplish more complex development tasks in the new architecture, and this was accomplished without affecting the ability to work as you are already accustomed to in 0.9.6 or previous releases.

            And integrating user systems is not difficult because of MODx; again, the reality is, PHP doesn’t provide standards or facilities to encourage easy integration here and it’s a crap shoot if how one developer implemented his user system is compatible with another.

            Quote from: rossco at May 02, 2008, 07:14 AM

            Will a test setup of 097 be available for people to browse so we have a working version to help us match up what goes where etc and when will 096 depreciate?
            Eventually, but after we get out of the alpha phase at least. It will be quite some time before 0.9.6 will be deprecated, though I imagine the value is depreciating for some people all the time (but I’m no accountant). wink
              • 14050
              • 788 Posts

              Eventually, but after we get out of the alpha phase at least. It will be quite some time before 0.9.6 will be deprecated, though I imagine the value is depreciating for some people all the time (but I’m no accountant). wink

              Damn Jason, why couldn’t you have brought this up early? I should have been deducting this as a business expense on my taxes. smiley
                Jesse R.
                Consider trying something new and extraordinary.
                Illinois Wine

                Have you considered donating to MODx lately?
                Donate now. Every contribution helps.