We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21417
    • 486 Posts
    Hello,

    Does anyone know of an updated WebLoginPE snippet floating around that will work on Evo 1.0.12 with a changed manager URL?

    We are currently using WebLoginPE 1.3.1 and have just updated from Evo 1.0.10 to Evo 1.0.12.
    I've changed the manager URL and now a « MODX Parse Error » error occurs because the "manager" folder name is included in line 148 of "webloginpe.class.php":
    require_once 'manager/includes/controls/class.phpmailer.php';


    I have manually changed manager to the new folder name for now.

    What's the trick with updating a snippet to work in 1.0.12 with a "flexible" manager name?

    Thanks in advance.
      Web design Adelaide
      http://gocreate.com.au
      • 4041
      • 788 Posts
      You should be able to use the constant MGR_DIR like this:

      require_once MGR_DIR.'/includes/controls/class.phpmailer.php';
      [ed. note: breezer last edited this post 10 years, 5 months ago.]
        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 21417
        • 486 Posts
        Thanks for the suggestion Breezer.

        Unfortunately when I try that, the whole site goes blank (all you see is a white page with no content).

        I also tried the following but that returns the word "error" on the screen:
        require_once($manager_path.'includes/controls/class.phpmailer.php');


        Any other ideas?
          Web design Adelaide
          http://gocreate.com.au
        • In breezers answer one dot is missing:

          require_once MGR_DIR.'/includes/controls/class.phpmailer.php';
            • 4041
            • 788 Posts
            lol yep I just saw that too jako smiley good catch - I fixed the above code so cross your fingers
              xforum
              http://frsbuilders.net (under construction) forum for evolution
              • 21417
              • 486 Posts
              Yes!! That works.
              require_once MGR_DIR.'/includes/controls/class.phpmailer.php';

              Thanks Breezer and Jako.

              (sorry for the delay in reply, I was having trouble logging into these forums recently)

              I can now load the page without error - and I can login which is great.

              But for some reason now the logout link (<a href="[~[*id*]~]&service=logout">Logout</a>) in the success message does not work so its impossible to logout without closing the browser.

              I searched the "webloginpe" snippet folder but the only other hard coded link to the manager folder that I can find is on line 1830 of the same webloginpe.class.php file referring to captcha but we don't use that in the login form so that shouldn't matter.

              I note that logout also does not work in 1.0.12 when using the standard manager call in webloginPE with an unchanged manager url:
              require_once 'manager/includes/controls/class.phpmailer.php';

              Maybe something has changed between 1.0.10 and 1.0.12 that would affect the logging out?

              Another quirk I have found: the phx call in the header that shows the logout message also no longer shows either: [+phx:webuserloggedin:then=`{{wlpe login hdr}}`:else=``+]. Not sure why that would be. My PHx version is 2.2.0.

              Any ideas of the logout and phx call issues?

              Thanks for all your help.
                Web design Adelaide
                http://gocreate.com.au
                • 4041
                • 788 Posts
                Unfortunately I don't know anything about wlpe or phx so can't be of any help there, but the following snippet should get you going till proper fixes for the issues can be found.

                Create a new snippet named wlpe_login_hdr using the following code:
                <?php
                /* 
                    wlpe_login_hdr snippet
                */
                $output ='';
                
                // check if user is logged in, if yes process the chunk
                if( isset( $_SESSION['webInternalKey'] ) ){
                
                    // determine url sep
                    $url_sep = $modx->config['friendly_urls'] =='0' ? '&' : '?';
                
                    // set up the replacement keys and values
                    $replace = array(
                        '[+url_sep+]'  => $url_sep
                    );
                    
                    // get the login hdr chunk content
                    $login_hdr_chunk = $modx->getChunk( 'wlpe login hdr' );
                    
                    $output = str_replace( array_keys( $replace ), array_values( $replace ), $login_hdr_chunk );
                
                }
                
                return $output;
                ?>


                Replace the phx call in your template with an uncached snippet call.
                ex:
                [!wlpe_login_hdr!]


                Change the logout link in your chunk like so:
                <a href="[~[*id*]~][+url_sep+]service=logout">Logout</a>

                  xforum
                  http://frsbuilders.net (under construction) forum for evolution
                  • 21417
                  • 486 Posts
                  Thanks so much Breezer, that's wonderful of you to spend the time on this.

                  The "wlpe_login_hdr" snippet is displaying nicely in the header, thanks.

                  It wasn't quite working as expected - logout was only working on the home page (with the address: domain.com), but not on any of the other pages, which finish in .php or /.

                  Then I changed the following two settings in Tools > Configuration > Friendly URLs...:
                  Make end slash URL at the container - changed to NO
                  Use SEO Strict URLs - changed to No

                  ...and logout now works on any page. Not sure why it wasn't working with those 2 settings enabled, but they must have been messing with the [+url_sep+] in the snippet??

                  We can live those settings off, its better that the log out works properly.

                  Many thanks for all your help.
                    Web design Adelaide
                    http://gocreate.com.au