On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I am having trouble getting Weblogin to redirect properly.

    I am trying to set up a client area on my website so that they can login using a Weblogin form and automatically get redirected to their own personal page.

    I set up the Web Users and set the Login Homepage in the Web User configuration to the page I want them to be redirected to once they login. I then created a separate document group and web user group and linked them for each of my clients.

    I then created a document for each of my clients and set the access permissions of the documents to the specific clients.

    I then used the Weblogin snippet to set up a login page. However it does not redirect to the clients specific page. Setting up &loginhomeid doesn’t seem to work properly as I need to specify each page id. I can get the first web user in the list to redirect to the first id in the &loginhomeid parameter. But any subsequent web users just end up being redirected to the site homepage.

    How do I connect the &loginhomeid parameter to the "Login Homepage" parameter in the Web User setup so that each individual client is automatically taken to their personal page?
    • Create a new plugin with the code below, name it whatever you want.
      On the System Events tab, under "Web Access Service Events", check OnWebLogin
      // start copying code below here
      /*  WU_Redirect_onlogin.plugin.php
      $e = &$modx->Event;
      switch ($e->name) {
      case "OnWebLogin":
         $WU_LoginHID =$_SESSION[webUsrConfigSet][login_home];
         if($WU_LoginHID !=''){
      default: "";
      // stop copying code here

      Make sure your plugin code does not have the start (<?php) and ending (?>) php tags or it breaks the plugin, they are just here for highlighting purposes smiley
        http://frsbuilders.net (under construction) forum for evolution
      • Hi Breezer,

        Thanks for the code. I just tried it, but it doesn’t appear to work.
        • I tested it on a totally stock 0963 setup and it works fine, although I do not have any document groups/etc set up, perhaps that is somehow kaboshing the plugin.
            http://frsbuilders.net (under construction) forum for evolution
          • I just tested it with a user group setup and it worked fine. If you edit the webuser and look on the User tab, down near the bottom in the Web Access Permissions part, is the document group checked that the user is supposed to be allowed to access?
              http://frsbuilders.net (under construction) forum for evolution
            • Yeah, I made sure that the document group was checked for the individual users. I’m also on MX 9.6.3.
              • Did you create the document groups in the Web Permissions or the Manager Permissions area?
                  http://frsbuilders.net (under construction) forum for evolution
                • I created them in the Web Permissions area.
                  • Have you tried calling the snippet without any loginhomeid’s set in the snippet?
                      http://frsbuilders.net (under construction) forum for evolution