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

    (I’m using the Login module with Revo 2.0.0pl)
    I have 3 questions about getting the connected users informations:

    1. Why the connected user actions don’t appear in the Online box in the Manager Home page? This box doesn’t seem to work anyway...

    2. I coded a snippet "GetUserField" to get the current connected user Fullname to write something like "Welcome <Fullname>!" but sometime it write the wrong name (the snippet is uncached), here is the snippet code:
    <?php
    $field = !empty($field) ? $field : 'fullname';
    $output = '';
    
    if (in_array($field,array('username','id')))
      $output .= $modx->user->get($field);
    else {
      $profile = $modx->user->getOne('Profile');
      $output .= $profile ? $profile->get($field) : '';
    }
    
    return $output;
    ?>


    3. Why when I’m connected in the manager, I’m seen as disconnected in the Front End part? (something about context isn’t it?)


    Maybe I should have writen these questions in diferent posts but I didn’t want to trust the forum, so I hope it’s ok like that and that someone will clarify my problems.

    Thank for the help,

    Thierry.

      • 36933
      • 35 Posts
      I am pretty new to Revo myself and not great with this stuff, but I think I can help with point 2.

      Once the user is logged in (using login snippet) then you just need to place the Profile snippet in the page and then call the placeholder you are after.

      for instance

      
      [[!Profile]]
      
      Welcome, [[+username]] thank you for joining our website.
      
      


      I am pretty sure you can use any of the fields within the users profile. So you can get address, zip, phone etc.... All I do to find the exact field name is go to Security | Manage Users in Manager. Right click the user and choose Update. Then I just view the source of the page and check the field I want so I get the exact field name. If you are using the Register snippet you can just add fields in your form for these as well and it will save them in the profile.

      The creators of this add on have also just added use for extended fields which is awesome (well done guys!!!)

      So you could do the following.

      [[!Profile? &useExtended=`1`]]
      
      [[+username]]
      
      [[+breed]]
      [[+veterinarian]]
      [[+color]]
      [[+neutered]]
      
      


      As long as you have those fields in your extended field list it will display the details.

      I hope this is what you were looking for.

      cheers
        • 29861
        • 59 Posts
        Thanks for the answer, I didn’t know about the Profile snippet. I’ll try it monday ;o). but if it works as described it should be fine for me. I’m also really interested in the "extended" option.
        Anxious to be Monday to try it. grin
        Thierry.