We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46886
    • 1,154 Posts
    Hi All, got a quick query for you.

    I am trying to help a new user with a fairly tricky issue, to grab the user data from modx and use that data in Muut, a forum system. Here is the link: http://forums.modx.com/thread/99335/need-help-with-php-connecting-muut-forum-to-modx

    Anyway, we were playing around with the modx code for getting user data, like this:
    <?php
    $profile = $modx->user->getOne('Profile');
         return $profile ? $profile->get('email') : '';


    And i found i can get fullname, email, id, but NOT username. What gives, anyone know?

    The problem over there is to take the Modx fullname, for example, and use it as the definition of the Muut terminology. So, we know we can get some/most of the user data we need for now, but how to pass it on?

    Looking for a little php help on that one wink
      • 4041
      • 788 Posts
      Although I know nothing when it comes to revo coding, after looking at the database structure I see the username is stored in a different table than the profile so I assume you'll have to use this to get the username ( copied from a previous post ):

      <?php
      // The current user can be retrieved in the API via the $modx->user reference. 
      // For example, this snippet outputs the username of the user:
         
      $modx_username = $modx->user->get('username');
      $profile = $modx->user->getOne('Profile');
      $profile_email = $profile ? $profile->get('email') : 'no email found';
      $output ='<p>Username: '. $modx_username .' - ( '. $profile_email .' )</p>';
      return $output;
      
        xforum
        http://frsbuilders.net (under construction) forum for evolution