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,

    I am using EVO 1.0.4 with WebLoginPE 1.3.1.

    At the moment the login form is located in the RHS column exclusively on one page with doc id #40 - WebLoginPE is doing a great job of hiding the secure pdf documents.

    How do I include the success message in the header of every page except doc 40 when a web user is logged in (eg if not logged in, no form is shown in the header)?

    My WebLoginPE call in the rhs column of doc 40 is:
    [!WebLoginPE? &type=`simple` &liHomeId=`40,1` &loHomeId=`40`  &loginFormTpl=`wlpe-loginFormTpl` &successTpl=`wlpe-successTpl` &messageTpl=`wlpe-messageTpl` &resetTpl=`wlpe-resetTpl` &activateTpl=`wlpe-activateTpl` &disableServices=`profile,saveprofilesimple,deleteprofilesimple,confirmdeleteprofilesimple,registernew,register,forgot,resetpassword,activate,activated` !]


    My success template is:
    [+wlpe.message+]
    <div id="loggedin">
    <form id="wlpeUserForm" action="[~[*id*]~]" method="POST">
    <p>[+user.username+] logged in.  
    <a href="[~[*id*]~]&service=logout">logout</a>
    </p>
    </form>
    </div>


    I do not want the form to be shown in the header - just the success message.

    Any ideas?

    Thanks in advance.
      Web design Adelaide
      http://gocreate.com.au
      • 21417
      • 486 Posts
      OK, so I have managed to get this working - though I am not sure if it is the best way to do it - or if there are security issues in using a blank form as the loginFormTpl in the header.

      1. I found a phx statement on the phx custom modifiers wiki (http://wiki.modxcms.com/index.php/PHx/CustomModifiers) that checks if a web user is loggd in - so I created a new snippet and called it "phx:webuserloggedin":
      <?php
      global $modx;
      $condition[] = intval(isset ($_SESSION['webValidated']));
      ?>
      


      2. Then I created a new webloginPE call as a chunk called "wlpe login hdr" for the header (which excludes the option to login as I only want the success message displayed in the header):
      [!WebLoginPE? id=`wlpe-Hd` &type=`simple` &loHomeId=`40` &loginFormTpl=`wlpe-loginFormTplHdr` &successTpl=`wlpe-successTpl` &messageTpl=`wlpe-messageTpl` &disableServices=`login,profile,saveprofilesimple,deleteprofilesimple,confirmdeleteprofilesimple,registernew,register,forgot,resetpassword,activate,activated` !]


      3. Then I created a new webloginPE loginFormTpl chunk called "wlpe-loginFormTplHdr" for the header (which is a blank form) - I am not sure if this is the right way to do it:
      [+wlpe.message+]
      
      <div id="wlpeLogin" class="login">
       <form class="loginForm" id="wlpeLoginForm" action="[~[*id*]~]" method="POST">
      
       </form>
      </div>


      4. Then I create a new chunk called "wlpe phx hdr" containing the phx "webuserloggedin" statement:
      [+phx:webuserloggedin:then=`{{wlpe login hdr}}`:else=``+]


      5. Then I include the "wlpe phx hdr" chunk into the page’s logo header:
      {{wlpe phx hdr}}


      6. Then I updated the CSS to hide the webloginPE message in the header on page 40 (as I only want to display the form / message in the rhs column on page 40):
      body#bd40 #hdbox #loggedin { display: none; }


      Any thoughts?
        Web design Adelaide
        http://gocreate.com.au