We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    I made a postHook that checks in what group a loggedinuser is in to redirect it to the correct landing page:

    <?php
    if ($modx->user->isAuthenticated() && $modx->user->isMember('Dealers')) {
       $modx->sendRedirect($modx->makeUrl(29));
       exit();
    } elseif ($modx->user->isAuthenticated() && $modx->user->isMember('Garagehouders')) {
       $modx->sendRedirect($modx->makeUrl(135));
       exit();
    } else {
       return;
    }
    


    but $modx->user->isMember() is false at that moment snippet runs, once logged in and i do logout its true?!
    the $modx->user->isAuthenticated() is true and when logged out its false

    both results I got when I put var_dumb($modx->user->isAuthenticated()) and var_dumb($modx->user->isMember(’myGroupName’)) on the top of this snippet.
    I think this is not the expected behavior.

    is this a bug? or am I missing something?
      follow me on twitter: @dimmy01
      • 4172
      • 5,888 Posts
      you can try this solution to redirect usergroups after being logged in.
      This needs a redirectUsergroups-page with this snippet in it.

      http://modxcms.com/forums/index.php/topic,59591.msg339086.html#msg339086
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 7455
        • 2,204 Posts
        I thought of that also using the above snippet but thats another resource misuse i think. it should be able to use a post hook for that that would be the best way.

        and the real problem is that when logging in the authentication is true but the group not and on logout the opposite. that is weird
          follow me on twitter: @dimmy01
          • 7455
          • 2,204 Posts
          I used this snippet on the same page as the login that way no new resource is used and it only fires when a user is logged in.
            follow me on twitter: @dimmy01