We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I don’t believe how easy this is! Complete user integration, single-sign on.

    1. Requires Vanilla 2 (at this point 2.0.3 is the latest). This must be on the same domain as your MODx site, since Vanilla has to be able to see the MODx cookie. (you can determine if this will work by putting a line in the main Vanilla index.php file
    print_r($_COOKIE)

    this must show the cookie for MODx; you can check the cookie name against the $site_sessionname in the MODx config.inc.php file)

    2. Install the SSO ProxyConnect plugin, enable it, activate the ProxyConnect method and fill out the configuration fields (which consist of the URLs to the various MODx pages you want to use and the cookie domain, which probably will be OK with the default). Log out of Vanilla.

    3. Create a snippet with the following code:
    <?php
    if(isset($_SESSION['webInternalKey'])) {
    $output = "UniqueID=" . $_SESSION['webInternalKey'] . "\n\n";
    $output .= "Name=" . $_SESSION['webShortname'] . "\n\n";
    $output .= "Email=" . $_SESSION['webEmail'] . "\n\n";
    return $output;
    }
    return;
    ?>


    4. Create a resource with no template, in fact nothing set except published, and the above snippet tags as its content. Basically, what you need is a page that does absolutely nothing but output those three values.

    5. Create a plugin using the OnWebLogout system event with the following code:
    $e = &$modx->Event;
    
    switch($e->name) {
        case 'OnWebLogout': // integrated logout
                setcookie('Vanilla', ' ', time() - 3600, '/', '.domain.com');
                unset($_COOKIE['Vanilla']);
        break;
    }


    Now you log in to MODx, and when you go to Vanilla you’ll get a popup asking if you want to create a new Vanilla account or sync with an existing Vanilla account (mostly useful for syncing to the existing admin account). Once that’s done, the user is now established. Log in, log out and register in MODx, and you’re automatically logged in to Vanilla when you’re logged in to MODx.



      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
    • Wow, that’s nice Sotwell, great contribution!
        • 28626
        • 87 Posts
        I’m having a hard time getting it working. I’m using Revo with the login add-on. I installed vanilla and followed the instructions you posted here and from your site: http://sottwell.com/article-vanilla.html

        I can’t get it to work together.

        my vanilla config.php
        <?php if (!defined('APPLICATION')) exit();
        
        // Conversations
        $Configuration['Conversations']['Version'] = '2.0.13';
        
        // Database
        $Configuration['Database']['Name'] = 'trefpunt';
        $Configuration['Database']['Host'] = 'xxxxxxxxxx';
        $Configuration['Database']['User'] = 'trefpunt';
        $Configuration['Database']['Password'] = 'xxxxxxxxx';
        
        // EnabledApplications
        $Configuration['EnabledApplications']['Skeleton'] = 'skeleton';
        $Configuration['EnabledApplications']['Conversations'] = 'conversations';
        $Configuration['EnabledApplications']['Vanilla'] = 'vanilla';
        
        // EnabledLocales
        $Configuration['EnabledLocales']['skeleton'] = 'en-CA';
        
        // EnabledPlugins
        $Configuration['EnabledPlugins']['GettingStarted'] = 'GettingStarted';
        $Configuration['EnabledPlugins']['HtmLawed'] = 'HtmLawed';
        $Configuration['EnabledPlugins']['ProxyConnect'] = 'ProxyConnect';
        $Configuration['EnabledPlugins']['ProxyConnectManual'] = 'ProxyConnectManualPlugin';
        
        // Garden
        $Configuration['Garden']['Title'] = 'elearning';
        $Configuration['Garden']['Cookie']['Salt'] = '4LGVJXP0HE';
        $Configuration['Garden']['Cookie']['Domain'] = '.onebuttonapps.net';
        $Configuration['Garden']['Version'] = '2.0.13';
        $Configuration['Garden']['RewriteUrls'] = TRUE;
        $Configuration['Garden']['CanProcessImages'] = TRUE;
        $Configuration['Garden']['Installed'] = TRUE;
        $Configuration['Garden']['Errors']['MasterView'] = 'error.master.php';
        $Configuration['Garden']['Authenticators']['proxy']['Name'] = 'ProxyConnect';
        $Configuration['Garden']['Authenticators']['proxy']['CookieName'] = 'VanillaProxy';
        $Configuration['Garden']['Authenticator']['EnabledSchemes'] = 'a:2:{i:0;s:8:"password";i:1;s:5:"proxy";}';
        
        // Plugin
        $Configuration['Plugin']['ProxyConnect']['IntegrationManager'] = 'proxyconnectmanual';
        
        // Plugins
        $Configuration['Plugins']['GettingStarted']['Dashboard'] = '1';
        $Configuration['Plugins']['GettingStarted']['Plugins'] = '1';
        
        // Routes
        $Configuration['Routes']['DefaultController'] = 'discussions';
        
        // Vanilla
        $Configuration['Vanilla']['Version'] = '2.0.13';
        
        // Last edited by admin (62.235.179.96)2010-11-03 09:33:37
        


        my proxy config settings.



        my plugin VanillaLogout:

        
        $e = &$modx->Event;
        
        switch($e->name) {
            case 'OnWebLogout': // integrated logout
                    setcookie('Vanilla', ' ', time() - 3600, '/', '.onebuttonapps.net');
                    unset($_COOKIE['Vanilla']);
            break;
        }
        
        


        proxy.html is the resource containing:

        [[VanillaLogin?]]
          • 28626
          • 87 Posts
          When I login and go to the forum I’m logged in but the user has no ’name’ or ’profile’. It seems as if the same user account is logged in no matter which user logs into the forum.

          I managed to get a bit further.

          It seems I had caching on for my proxy page which returned wrong user info. Now it seems to work but it gets stuck on the handshake.

          http://elearning.onebuttonapps.net/forum/entry/handshake/proxy

          this gives a blank page and doesn’t redirect to the forum.

          Finally I removed from the config
          $Configuration['Garden']['Authenticator']['SyncScreen'] = FALSE;
          


          And now it works fine, strange thing is it doesn’t even ask to sync accounts just goes straight into the right account.
            • 33527
            • 2 Posts
            Really simple - to integrate Modx Revolution + Vanilla 2

            If anyone ’ll have a problem with sign out from vanila read http://vanillaforums.org/discussion/13698/patch-for-proxyconnect-problems

              • 11858
              • 130 Posts
              Thanks for this Susan. I’ve managed to get this working, with two issues.

              When I log in to MODx revo and then visit the forums all is fine. When I log out within vanilla, the user logs out both modx and vanilla as it should.

              First Issue:
              Sometimes when I login to modx, then go over to vanilla, I’m not signed in until I click on the "sign in" button in vanilla, it then picks up the cookie and all is ok. I’m not sure why it does this sometimes and other times logs directly in without having to click on "sign in" in vanilla.

              Second Issue:
              When I go back to the modx site and click logout, I revisit the forum and the user is still signed into Vanilla, but not modx. I can log in now as another user, and the old user is still active in Vanilla, but the new user is logged into Modx.

              This can all be corrected if I use ONLY the Logout button within vanilla and not Modx.

              Sounds like the plugin isn’t firing and deleting the Vanilla cookie on the MODx logout, but is ok on the Vanilla logout. I’m developing on localhost:8888 under MAMP so I have changed the snippet code to:

              <?php
              $e = &$modx->Event;
              
              switch($e->name) {
                  case 'OnWebLogout': // integrated logout
                          setcookie('Vanilla', ' ', time() - 3600, '/', 'localhost:8888');
                          unset($_COOKIE['Vanilla']);
                  break;
              }
              


              And also tried

              <?php
              $e = &$modx->Event;
              
              switch($e->name) {
                  case 'OnWebLogout': // integrated logout
                          setcookie('Vanilla', ' ', time() - 3600, '/', 'localhost');
                          unset($_COOKIE['Vanilla']);
                  break;
              }
              


              with no cigar. Any ideas why this isn’t firing on logout? The "OnWebLogout" param is checked. I’m so close to having a functioning forum on this site! Thanks.
                • 11858
                • 130 Posts
                Figured it out, had to change the localhost part of the plugin to false as specified here http://www.aeonity.com/frost/php-setcookie-localhost-apache

                Just need to remember to set it back when it goes live. Cheers
                  • 22019
                  • 390 Posts
                  Has anyone got Proxyconnect 1.8.4 working with Vanilla 2.0.17.8?

                  I had it working with MODx for vanilla 2.0.9 (and I think 2.0.16) but foolishly installed a fresh version (the site’s still in development) and now I can’t even configure the authenticator properly, let alone get SSO working.
                    Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
                    • 27716
                    • 126 Posts
                    Hi Guys,

                    Im also attempting this with Proxy connect Version 1.8.4 and the settings that this method is saying to configure are not there at all.

                    Does anyone know how to configure this with 1.8.4

                    Any assistance appreciated!

                    Stuart
                    • I’m sorry, people, I haven’t had a chance yet to work with the latest versions. When I do, I’ll be sure to update this post as well as the tutorial on my site.
                        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