We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4169
    • 0 Posts
    This is an auto-generated topic for redirectUsergroups 1.0-rc1 by bruno.

    Brief Description:


    Redirect Users of specified groups to specified Resources
    Example:
    [[!redirectUsergroups? &redirs=`Frontenduser:3||Testuser:8`]]
      • 23819
      • 37 Posts
      there seems to be some issues with the version in pakadge management.
      I had to modify the snippet code to get it to work for me.

      this is the code I am now using :

      <?php
      if (isset($redirs)){
          $redirs=explode(',',$redirs);
          if (count($redirs)>0){
              foreach ($redirs as $redir){
            
                $redir=explode(':',$redir);
                    
                  if (count($redir)==2){
         
                      if ($modx->user->isMember($redir[0])){
                          $url=$modx->makeUrl($redir[1]);
                      }            
                  }
              }
          }
      }
      
      return  $modx->sendRedirect($url);
      


      and I use it like this :

      [[!RedirectUsergroups? &redirs=`Frontenduser:18,Premiumuser:22,Golduser:27`]]

      to begin with the isset($redirs) was making an error because of it lacked these guys around it : ()
      and I also prefered to use Usergroup:id,Anothergroup:otherid format, because to me, it’s easier to read. hope this can help someone.

      PWD
        • 34108
        • 66 Posts
        Thanks for posting your code fix PWD - I had the exact same problem with the missing ().

        Sorry if this is a dumb question to ask - but where exactly does the call go? I’m using it in conjuntion with the Login package, so does it go in the login template, or somewhere else entirely?

        Thanks again
        Harmony
          • 4172
          • 5,888 Posts
          use the &loginResourceId=`x` property to redirect all logged-in users to this resource. On this resource place the snippet-call for redirecting different usergroups to different pages.

          @pranawebdesign:
          Thanks! Uploaded a new Version with your fixes.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 34108
            • 66 Posts
            That makes sense, thanks Bruno smiley

            I’ve just tried this, and the login page redirects to the redirection page just fine, but it gets stuck there and won’t then redirect the logged-in user anywhere.

            The code I’m using on the ’Redirect’ page is:

            [[!redirectUsergroups? &redirs=`iga-general:114`]]

            I’ve assigned page 114 to the iga-general user and resource group but still no luck - any idea what I might be doing wrong?

            Many thanks
            Harmony

            Edit - Am using MODX Revolution 2.1.1-pl (traditional), Login 1.6.2, and RedirectUserGroups 1.0 . Have tested on both Firefox and IE.
              • 4172
              • 5,888 Posts
              this works fine for me.

              Did you flush permissions and you are not logged in the manager, when you are testing?
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 34108
                • 66 Posts
                Yes flushed cache and permissions, and then tested on a different browser after emptying browser cache and cookies.
                  • 4172
                  • 5,888 Posts
                  Do you have access to your usergroup-landingpage after login?
                  what happens when you are making the usergroup-landingpage public for all vistors for testing?
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 34108
                    • 66 Posts
                    Quote from: Bruno17 at Jun 17, 2011, 03:06 AM

                    Do you have access to your usergroup-landingpage after login?
                    what happens when you are making the usergroup-landingpage public for all vistors for testing?

                    Hi Bruno, thanks again for your help with this, I appreciate it!

                    Yes I can see the usergroup landing page after login if I click on the menu link, it just doesn’t redirect there automatically on login.

                    When I make the same landing page public in terms of permissions, then re-tested on empty modx cache and empty browser cache and cookies, it behaves the same as above.
                      • 34108
                      • 66 Posts
                      Hi again, I’m troubleshooting a hunch - could you please tell me which version of Revo and the Login package you are using?