We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Thanks. I am going to look into the isMember direction, but for now I am going to use the solution in reply #5 in http://forums.modx.com/thread/44073/solved-can-you-have-multiple-login-resource-ids-in-revolution

      Lee Brinckley
      Manassas, VA (Washington DC)
      Twitter - @leebrinckley
      http://www.leebrinckley.com
      • 3749
      • 24,544 Posts
      For user groups (assuming that you have the username but not the user object) you can do this:


      $usr = $modx->getObject('modUser', array('username' => $userName));
      
      if ($usr) {
          if ($usr->isMember('SomeGroup')) {
              /* redirect here as shown earlier in this thread */
          }
      
      }
        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
      • Quote from: BobRay at Mar 12, 2013, 07:56 PM
        For user groups (assuming that you have the username but not the user object) you can do this:


        $usr = $modx->getObject('modUser', array('username' => $userName));
        
        if ($usr) {
            if ($usr->isMember('SomeGroup')) {
                /* redirect here as shown earlier in this thread */
            }
        
        }

        Thanks...I will take a look at this!
          Lee Brinckley
          Manassas, VA (Washington DC)
          Twitter - @leebrinckley
          http://www.leebrinckley.com
          • 37143
          • 74 Posts
          Hi, I have used this similar setup, and my redirect works (thanks to everyone above), but the URL in the window stays at the login page url instead of the url of the page I am redirecting to. Anyone know why this is the case? Here is my snippet that I am using:

          <?php
          $username = $hook->getValue('username');

          $pageId = '354';

          switch ($username) {
          case 'Cablevision':
          $pageId = '407';
          break;
          case 'Cableone':
          $pageId = '405';
          break;
          }

          $landingPage = $modx->makeUrl($pageId, "", "", 'full');
          $modx->sendRedirect($landingPage);

          Thanks
          Anthony


          Quote from: BobRay at Nov 28, 2011, 02:47 PM
          Try putting this as line 3:

          die( ' Username:  ' . $username);


          You may have to use one of these:

          $username = $hook->getValue('username');
          $username = $hook->getValue('login.username');


          Also, always generate a full URL with makeUrl():

          $landingPage = $modx->makeUrl($pageId, "", "", 'full');
          [ed. note: [email protected] last edited this post 10 years, 6 months ago.]
            • 3749
            • 24,544 Posts
            That would be normal if you were using $modx->sendForward(), but It's not supposed to be like that with sendRedirect(). I don't know what would cause that unless you have some other plugin modifying the URL.


              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
              • 10525
              • 247 Posts
              I just came across this post while looking for a way to create different login landing pages for each user group.

              I was a bit surprised to discover that there isn't a system setting for this. How easy would it be to create a new system setting for a site-wide default login landing page (ie the equivalent of Login snippet's loginResourceId property)? Then there would be a built-in landing page (eg in System Settings > Authentication and Security) and it would be easy to set user and user-group specific login landing pages as custom settings?
                • 3749
                • 24,544 Posts
                Doing that is complicated by the fact that users can (and often do) belong to more than one User Group. You could create a User Setting for each user called 'landing_page' and use that in the Login snippet tag:

                [[!Login? &loginResourceID=`[[++landing_page]]`]]

                  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
                  • 4172
                  • 5,888 Posts
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 4757
                    • 64 Posts
                    I'm really a novice at this stuff so please be patient. This thread may solve my problem but I want layout what I'm trying to do to see if anyone has a better solution.

                    The site is supposed to have business listing for our Downtown. Business owners need to be able to create a login. They will be sent an registration email with a link to page to create their business listing (i'm using NewsPublisher for this piece) then any subsequent times the user logs in they should be redirected to their specific business listing to update/edit (again using news publisher).

                    How do I get them redirected to their unique page upon login?

                    I have login and newspublisher installed and working but connecting it all together is where I'm lost. [ed. note: CBorah last edited this post 10 years ago.]