We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26401
    • 247 Posts
    Hi there, I was wondering how I can get the web user name.

    I want to create a snippet that shows either the username or the link to go to login page.
    I’m looking to use a conditional (snippet), but I don’t know how to access [+user.fullname+] inside another snippet

      • 26401
      • 247 Posts
      well this worked, I forgot to call the snippet un-cached. OOPS grin

      <?php
      include_once ($modx->config['base_path'] . "manager/includes/document.parser.class.inc.php");
      
      $modx->runSnippet('WebLogin',  array('amptype'=>'simple', 'loginFormTpl'=>'LoginFormTpl'));
      
      echo $modx->getPlaceholder('user.username');
      ?>
      


      I should point out for anyone looking at this, that this is not the way to do this.
      That conditional is already inside the snippet, so the trick is to just pass a template that has the links I needed.

      I will have to come up with a way still to hide it on the login page, so it doesn’t show up when the full login form is shown.


      now I’d just like to log-out with a link instead of a button...