We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37152
    • 12 Posts
    [[+ createdby: userinfo = `extended`]]
    returns 'Array'. This array should be located field, which I need to withdraw. Question: how to get this field?

    Thank you. Forgive sorry if the question is stupid.
      • 3749
      • 24,544 Posts
      Is that tag in a Tpl chunk, or in the page content?

      If in a Tpl chunk, try this:

      [[+createdby:userinfo=`username`]]


      If it's in the page content, try this:

      [[*createdby:userinfo=`username`]]
        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
        • 37152
        • 12 Posts
        Sorry for the long answer.

        The question is to get the extra user field using this design.
        [[+ Createdby: userinfo = `extended`]] / / prints "Array".

        How to access elements of Arran?
          • 3749
          • 24,544 Posts
          I think the Profile snippet will do what you want. It will set placeholders for all the fields in the profile, so in your page, do this:

          [[!Profile? &user=`[[*createdby]]` ]]
          
          Username: [[+username]]
          Email: [[+email]]
          // etc.
            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
            • 37152
            • 12 Posts
            This is the method I use, but in this case there are problems associated with the cache. When a cyclical output's structures (eg, getPaga or getResousces) shows the same value. For example, in deriving the comments QuiP, author of the comment everywhere meaning one and the same user (probably the first or last iteration of the loop values).

            [[!Profile?
                            &user=`[[+authorName]]`
                            &prefix=`usr.`
            ]]
            <span class="quip-comment-author">[[+usr.charactername]]:</span><br />
            <span class="quip-comment-createdon"><a href="[[+url]]">[[+createdon]]</a>
              • 3749
              • 24,544 Posts
              Profile wants a username or an ID for the &user property. Unless the the authorName placeholder is set to one of those at the time when the Profile tag executes, you're not sending anything for that property, in which case Profile uses the current user (you).

              If it is being set, this might help:

              &user=`[[!+authorName]]`


              That should make that placeholder uncached.
                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
                • 37152
                • 12 Posts
                Unfortunately, [[!+AuthorName]] produces no output.

                I think the problem with caching is a snippet Profile, as [[+authorName]] in a series of shows without duplication. So I decided to ask here about an alternative way to derive additional fields the user.