We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29333
    • 26 Posts
    Hey there!

    In the API Quick Reference.doc from modx_docs.zip I saw 3 functions:
    _______________________________________________________
    getLoginUserID
    Returns current user id.

    getLoginUserName
    Returns current user name.

    getLoginUserType
    Returns current login user type - web or manager
    ------------------------------------------------------------------------------------------------

    Now the thing is that there are no additional details about them...
    I tried to use them to build a snippet to display the current user information but the snippet doesn’t work. If I put the snippet in a page... let’s say the home page when I try to load it the whole page remains blank. Any suggestions ?

    Here is the snippet code:
    __________________________________________________
    $out = "Current User ID: ";
    $out .= getLoginUserID();
    $out .= "; User Name: ";
    $out .= getLoginUserName();
    $out .= "; User Type: ";
    $out .= getLoginUserType();
    return $out;
    --------------------------------------------------------------------------------------

    Any suggestions huh
      Mosh-pit rules !!!
      • 33337
      • 3,975 Posts
      Try this
      $out = "Current User ID: ";
      $out .= $modx->getLoginUserID();
      $out .= "; User Name: ";
      $out .= $modx->getLoginUserName();
      $out .= "; User Type: ";
      $out .= $modx->getLoginUserType();
      return $out;
      


      Regards,

      zi
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 29333
        • 26 Posts
        Thanks a lot !!! wink

        $modx is a class, right huh
        Every function in "API Quick Reference.doc" must be called in that manner huh
        Please tell me if "API Quick Reference.doc" contains all the functions/constants/variables in $modx.

        If it doesn’t, where can I get the full list huh

        Thanks again.... I hope I get an answer!
          Mosh-pit rules !!!
        • The full list is found in /manager/includes/documentparser.class.php

          The documentation may be a bit behind as this is just the Technology Preview phase of the product. Enjoy!
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me