We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21092
    • 54 Posts
    neelhtak_backwards Reply #1, 17 years, 1 month ago
    Hey,
    I’ve been using/learning modx for only a few weeks now, and have come across an issue that I cannot fix myself.

    Issue:
    My website www.katskinner.com has a user login and register section. I have been using the sample content that is optional at install.
    The register section works fine for web users, however I do find an issue when a web user attempts to log in. Upon clicking login, the following "page" is displayed:

    « MODx Parse Error »

    MODx encountered the following error while attempting to parse the requested resource:
    « `` is not numeric and may not be passed to makeUrl() »

    Parser timing
    MySQL: 0.0091 s (32 Requests)
    PHP: 0.0607 s
    Total: 0.0698 s


    If immediately browsing to a different page within my website, the login code recognizes that the web user is logged in.
    The logout button seems to work fine.

    This is the code that I am using for the FormLogin (slight editing from the sample content):
    <!-- #declare:separator <hr> -->
    <!-- login form section-->
    <form method="post" name="loginfrm" action="[+action+]">
    <input type="hidden" value="[+rememberme+]" name="rememberme" />
    <fieldset>
    <h3>Your Login Details</h3>
    <label for="username">User: <input type="text" name="username" id="username" tabindex="1" onkeypress="return webLoginEnter(document.loginfrm.password);" value="[+username+]" /></label>
    <label for="password">Password: <input type="password" name="password" id="password" tabindex="2" onkeypress="return webLoginEnter(document.loginfrm.cmdweblogin);" value="" /></label>
    <input type="checkbox" id="checkbox_1" name="checkbox_1" tabindex="3" size="1" value="" [+checkbox+] onclick="webLoginCheckRemember()" /><label for="checkbox_1" class="checkbox">Remember me</label>
    <input type="submit" value="[+logintext+]" name="cmdweblogin" class="button" />
    <a href="#" onclick="webLoginShowForm(2);return false;" id="forgotpsswd">Forget Your Password?</a>

    </br>
    <a href="index.php?id=5" onclick="" id="forgotpsswd">Become a Member</a>
    </fieldset>
    </form>
    <hr>
    <!-- log out hyperlink section -->
    <h4>You’re already logged in</h4>
    Do you wish to <a href="[+action+]" class="button">[+logouttext+]</a>?
    <hr>
    <!-- Password reminder form section -->
    <form name="loginreminder" method="post" action="[+action+]">
    <fieldset>
    <h3>It happens to everyone...</h3>
    <input type="hidden" name="txtpwdrem" value="0" />
    <label for="txtwebemail">Enter the email address of your account to reset your password: <input type="text" name="txtwebemail" id="txtwebemail" size="24" /></label>
    <label>To return to the login form, press the cancel button.</label>
    <input type="submit" value="Submit" name="cmdweblogin" class="button" /> <input type="reset" value="Cancel" name="cmdcancel" onclick="webLoginShowForm(1);" class="button" style="clear:none;display:inline" />
    </fieldset>
    </form>




    Could someone please tell me what I am doing wrong (I am assuming its in the above code)and how to fix it? I preferably want the user to be automatically redirected straight back to the page they were previously on, but if absolutely necessary then to the home page.

    I can provide more information upon request.

    For your assistance I have created a test web user account for my site -
    Login: test
    Password: password


    Please note: I have a very limited scripting and modx experience.
      Visit www.katskinner.com for all your expert novel writing tips, tutorials and more.
      • 4310
      • 2,310 Posts
      Welcome Kathleen,
      Can you post your weblogin snippet call?
      It looks like it may be an error in forwarding to the login home page.
        • 21092
        • 54 Posts
        neelhtak_backwards Reply #3, 17 years, 1 month ago
        Bunk58,
        Thanks for the speedy reply. Below is the weblogin Snippet call I use:

        [!WebLogin? &tpl=`FormLogin` &loginhomeid=`[(site_start)]`!]

        I also have added my weblogin snippet below just in case that might help.

        <?php
        # WebLogin 1.0
        # Created By Raymond Irving 2004
        #::::::::::::::::::::::::::::::::::::::::
        # Usage:
        # Allows a web user to login to the website
        #
        # Params:
        # &loginhomeid - (Optional)
        # redirects the user to first authorized page in the list.
        # If no id was specified then the login home page id or
        # the current document id will be used
        #
        # &logouthomeid - (Optional)
        # document id to load when user logs out
        #
        # &pwdreqid - (Optional)
        # document id to load after the user has submited
        # a request for a new password
        #
        # &pwdactid - (Optional)
        # document id to load when the after the user has activated
        # their new password
        #
        # &logintext - (Optional)
        # Text to be displayed inside login button (for built-in form)
        #
        # &logouttext - (Optional)
        # Text to be displayed inside logout link (for built-in form)
        #
        # &tpl - (Optional)
        # Chunk name or document id to as a template
        #
        # Note: Templats design:
        # section 1: login template
        # section 2: logout template
        # section 3: password reminder template
        #
        # See weblogin.tpl for more information
        #
        # Examples:
        #
        # [[WebLogin? &loginhomeid=`8` &logouthomeid=`1`]]
        #
        # [[WebLogin? &loginhomeid=`8,18,7,5` &tpl=`Login`]]

        # Set Snippet Paths
        $snipPath = $modx->config[’base_path’] . "assets/snippets/";

        # check if inside manager
        if ($m = $modx->insideManager()) {
        return ’’; # don’t go any further when inside manager
        }

        # deprecated params - only for backward compatibility
        if(isset($loginid)) $loginhomeid=$loginid;
        if(isset($logoutid)) $logouthomeid = $logoutid;
        if(isset($template)) $tpl = $template;

        # Snippet customize settings
        $liHomeId = isset($loginhomeid)? explode(",",$loginhomeid):array($modx->config[’login_home’],$modx->documentIdentifier);
        $loHomeId = isset($logouthomeid)? $logouthomeid:$modx->documentIdentifier;
        $pwdReqId = isset($pwdreqid)? $pwdreqid:0;
        $pwdActId = isset($pwdactid)? $pwdactid:0;
        $loginText = isset($logintext)? $logintext:’Login’;
        $logoutText = isset($logouttext)? $logouttext:’Logout’;
        $tpl = isset($tpl)? $tpl:"";

        # System settings
        $webLoginMode = isset($_REQUEST[’webloginmode’])? $_REQUEST[’webloginmode’]: ’’;
        $isLogOut = $webLoginMode==’lo’ ? 1:0;
        $isPWDActivate = $webLoginMode==’actp’ ? 1:0;
        $isPostBack = count($_POST) && (isset($_POST[’cmdweblogin’]) || isset($_POST[’cmdweblogin_x’]));
        $txtPwdRem = isset($_REQUEST[’txtpwdrem’])? $_REQUEST[’txtpwdrem’]: 0;
        $isPWDReminder = $isPostBack && $txtPwdRem==’1’ ? 1:0;

        $site_id = isset($site_id)? $site_id: ’’;
        $cookieKey = substr(md5($site_id."Web-User"),0,15);

        # Start processing
        include_once $snipPath."weblogin/weblogin.common.inc.php";
        include_once ($modx->config[’base_path’] . "manager/includes/crypt.class.inc.php");

        if ($isPWDActivate || $isPWDReminder || $isLogOut || $isPostBack) {
        # include the logger class
        include_once $modx->config[’base_path’] . "manager/includes/log.class.inc.php";
        include_once $snipPath."weblogin/weblogin.processor.inc.php";
        }

        include_once $snipPath."weblogin/weblogin.inc.php";

        # Return
        return $output;
        ?>
          Visit www.katskinner.com for all your expert novel writing tips, tutorials and more.
          • 4041
          • 788 Posts
          Looks like [(site_start)] isn’t being processed to an id by the time it’s used in the weblogin script, try using the actual id of the page you are sending them to in your snippet call:

          ex: [!WebLogin? &tpl=`FormLogin` &loginhomeid=`2`!]
            xforum
            http://frsbuilders.net (under construction) forum for evolution
            • 21092
            • 54 Posts
            neelhtak_backwards Reply #5, 17 years, 1 month ago
            Breezer,
            Thanks for that, I did link to the ID instead and it worked perfectly.
            Is there any way to make it link back to the page that the user was previously on?

            Thanks
            Kathleen
              Visit www.katskinner.com for all your expert novel writing tips, tutorials and more.
              • 4041
              • 788 Posts
              You should be able to remove the &loghomeid=`X` param from the snippet call and it will refresh back to the page they were viewing when they logged in, unless there is a login home id specifically set in their user settings (which will override any parameters you pass in the snippet).

              [!WebLogin? &tpl=`FormLogin`!]
                xforum
                http://frsbuilders.net (under construction) forum for evolution
                • 21092
                • 54 Posts
                neelhtak_backwards Reply #7, 17 years, 1 month ago
                Thanks for all the help, I appreciate it. Solved the problem!
                  Visit www.katskinner.com for all your expert novel writing tips, tutorials and more.

                This discussion is closed to further replies. Keep calm and carry on.