We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32858 ☆ A M B ☆
    • 2 Posts
    Hi,
    I’ve been searching around to find something fit my need, which returning author name of a resource by his id.
    I found one but it was for Evolution version. I’m using Revolution and its APIs do seem differently, I’m on API page now to read and fix the authorTime snippet and I’m sinking when diving in. While I’m trying to figure out how to work with modx API, hope that someone here has already had a working solution that might share.
    Thanks.
      • 32858 ☆ A M B ☆
      • 2 Posts
      Thanks for metaFormat snippet, I’ve read and found what i need in it. Here are the simple code I use to solve this simple problem. I’m not really familiar with the revolution coding style and working method. Hope I will adapt it well soon. Patience is the greatest thing I think I will learn when adapting to modx.
      Besides, sorry for my bad English.

      	  
      if (!isset($modx)) return '';
      $user = $modx->getObject('modUserProfile', $modx->resource->get('editedby'));
      return $user->get('fullname');
      
        • 3749
        • 24,544 Posts
        Looks good.

        You could also use:

        $user = $modx->resource->getOne('EditedBy');


        Note the capital letters in "EditedBy".
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 32858 ☆ A M B ☆
          • 2 Posts
          Quote from: BobRay at Aug 01, 2011, 05:44 PM

          Looks good.

          You could also use:

          $user = $modx-> resource-> getOne(EditedBy);


          Note the capital letters in "EditedBy".

          Well, I didnt realize it existed in API. Is that xPDO method?
            • 28215
            • 4,149 Posts
            Quote from: xgenvn at Aug 01, 2011, 10:44 PM

            Well, I didnt realize it existed in API. Is that xPDO method?

            Yes. It’s actually:

            $user = $modx->resource->getOne('EditedBy');

            (with quotes)

            http://rtfm.modx.com/display/xPDO20/Working+with+Related+Objects


              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 3749
              • 24,544 Posts
              Wanted: Open source PHP code keyboard for Android phone. wink
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 32858 ☆ A M B ☆
                • 2 Posts
                Quote from: splittingred at Aug 01, 2011, 11:48 PM

                Quote from: xgenvn at Aug 01, 2011, 10:44 PM

                Well, I didnt realize it existed in API. Is that xPDO method?

                Yes. It’s actually:

                $user = $modx->resource->getOne('EditedBy');

                (with quotes)

                http://rtfm.modx.com/display/xPDO20/Working+with+Related+Objects




                Hi, thanks for your reply, I’m diving into the docs.
                Thanks again.