We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40088
    • 708 Posts
    I have 2 Member Profile pages: View Profile [[!Profile]] and Edit Profile [[!UpdateProfile]] which use several extended fields.

    As expected, the correct extended fields are shown for the actual signed-in user. So far so good. However, one extended field [[+screen]] is problematic. Instead of showing the correct value for the user it's returning the value for the admin despite the fact that the user's profile (in the Manager) shows the correct value for [[+screen]]. It's just not making it to the front-end.

    Also, the [[+screen]] extended field is used on the login link and that seems to be working fine. It's odd.

    Here's my Profile snippet:
    [[!Profile?
        &useExtended=`1`
    ]]
    <ul>
        <li>[[+screen]]</li> //Incorrectly shows admin name, instead of user
    </ul>

    This question has been answered by sottwell. See the first response.

    [ed. note: todd.b last edited this post 11 years, 9 months ago.]
      Todd
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Are you logged in to the Manager as well, when testing this? Always use a different browser that is not logged in to the Manager when testing front-end login features.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 40088
        • 708 Posts
        It happens when I'm not logged into the Manager. That's what's so odd.

        In any case I ended up adding &user=`[[*id]]` to the Profile snippet:
        [[!Profile?
            &user=`[[*id]]`
            &useExtended=`1`
        ]]
        [[+screen]]


        It seems to work. [ed. note: todd.b last edited this post 11 years, 9 months ago.]
          Todd
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The [[*id]] is the resource ID for the current page, it has nothing to do with user IDs.

          You can use [[++modx.user.id]] to get the current user ID. Actually, you can use
          [[++modx.user.id:userinfo=`extended.fieldname`]]

          to get an extended field as long as it's in the outer level, not in a container.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 40088
            • 708 Posts
            Thank you Susan. Works well.

            I am curious as to why only the one field is wrong when the other 6 extended fields on the same page render fine. Oh well.

            On a slight tangent but also regarding the [[+screen]] extended field, I'm using a Chunk with getResources to show recent articles. It works ok except for showing the name of the member who actually created the resource. It either shows the admin name or, in the event a user is signed-in, the named of that user, but never the actual author.
            <h2><a href="[[~[[+id]]]]">[[+pagetitle]]</a></h2>
            [[+publishedon:strtotime:date=`%m.%d.%Y`]] <a href="[[filter-resources-by-author]]">[[+screen-placeholder-for-author]]</a>
            [ed. note: todd.b last edited this post 11 years, 9 months ago.]
              Todd
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I would use
              [[+createdby:userinfo=`fullname`]]


                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 40088
                • 708 Posts
                Yes, that would be easier, but for reasons of privacy it's not an option. The [[+screen]] extended field allows members to create a screen name that is attached to their resources in place of fullname or (gasp) username.
                  Todd
                • discuss.answer
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  [[+createdby:userinfo=`extended.screen`]]
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org