We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25551 ☆ A M B ☆
    • 1,231 Posts
    I need some help with sharing SESSIONS amongst modx and another app. Is it right that as long as the 2 apps are on the same server/domain it should be fairly straight forward to work with?

    How would I go about gathering SESSIONS from one app in to modx? I know this is rather vague but I am just wondering if it’s as straight forward as I hope. Modx uses session_start() as does the second app, how can I take $_SESSION[’id’] from app 2 in to modx? Do I have to define something, include a file or use globals? SMF was fairly easy due to the usage of SSI but now I’m stuck with trying to access SESSIONS from another app.

    Thanks
      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
      AugmentBLU - MODX Partner

      BLUcart - MODX Revolution E-Commerce & Shopping Cart
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      MODx uses a unique session_name. This is automatically created at installation, and can be found in your config.inc.php file.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 25551 ☆ A M B ☆
        • 1,231 Posts
        Sorry Susan I don’t understand how that will help me? Could you give me a little explanation please?
          Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
          AugmentBLU - MODX Partner

          BLUcart - MODX Revolution E-Commerce & Shopping Cart
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: rossco at Apr 12, 2010, 06:53 AM

          Sorry Susan I don’t understand how that will help me? Could you give me a little explanation please?
          It doesn’t help you other than letting you know how you could identify the MODx session_name and possibly modify the other application to use the MODx session that way. Ultimately though, sharing sessions would require fundamental changes to one or both applications you attempt to integrate, since there is no common PHP API that directs folks how to use sessions in a consistent way. Every application basically goes off and does unique things to accomplish what they need to with sessions.

          IMO, authentication/authorization integration like this should be done through web services, but unfortunately, very few applications have such services already available to use.
            • 25551 ☆ A M B ☆
            • 1,231 Posts
            Thanks OG for the info. I actually created a plugin that ties in to the SSI.php of SMF and managed to join them both up but required quite a lot of work. It was doable due to the SSI feature of the SMF forum.

            I wonder if something like the SSI would work for another app.
              Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
              AugmentBLU - MODX Partner

              BLUcart - MODX Revolution E-Commerce & Shopping Cart
              • 22303 MODX Staff
              • 10,725 Posts
              Quote from: rossco at Apr 12, 2010, 12:40 PM

              Thanks OG for the info. I actually created a plugin that ties in to the SSI.php of SMF and managed to join them both up but required quite a lot of work. It was doable due to the SSI feature of the SMF forum.
              It’s awesome that you accomplished this; I’ve started on such an integration a couple of times and gave up both times after driving myself insane. Is this shareable with the community or too specific to your requirements?

              Quote from: rossco at Apr 12, 2010, 12:40 PM

              I wonder if something like the SSI would work for another app.
              We use Crowd via SOAP for modxcms.com authentication and user integration (implemented on Revolution) and the code couldn’t be simpler. I hope to publish this for reference along with a tutorial in the very near future, and will be looking into doing a couple of other external user integration examples soon, but I can tell you using the SSI API that SMF provides..., well, let’s just say my grandmother taught me not to say anything at all if I couldn’t say anything nice.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                my grandmother taught me not to say anything at all if I couldn’t say anything nice
                Every now and then you guys make me feel ancient... it was my mother telling me that.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 25551 ☆ A M B ☆
                  • 1,231 Posts
                  OG, what I have created takes a users ID from the SSI. SSI has a full array of SESSIONS from SMF so you can easily tap in to the information. I then created a plugin that took the users info from the SSI and sent it to custom tables that modx will use. The plugin also updates modx tables if any changes are made on the SMF side but only if the user accesses areas of modx that displays any of the users details. The user still signs in to SMF but I have allowed access to modx by using the SESSIONS from smf. I don’t actually know how good my coding is but it works. It’s been a very big project and I’m still working on it.

                  Once the site is actually fully integrated I will post what I have done.

                    Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                    AugmentBLU - MODX Partner

                    BLUcart - MODX Revolution E-Commerce & Shopping Cart