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

    I have

    [[!Profile? &prefix=`user.`]]


    at the top of a page.

    In the body of the page, I have

    [[!user.fullname]]


    which outputs John Doe as the full name so that works as expected.

    I have a form on the page that needs to split the firstname and surname, so I created an output modifier (a snippet called getFirstname) with:

    $fullname = explode(" ",$input);
    $firstname = $fullname[0];
    return $firstname;


    and changed my placeholder to

    [[!user.fullname:getFirstname]]


    However this does *not* work. Any ideas? What am I missing?

    Thanks in advance.


      • 3749
      • 24,544 Posts
      [[!+user.fullname:getFirstname]]
         ^
         |


      ;)
        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
        • 23510
        • 168 Posts
        Sorry, typo in my post. It is indeed

        [[!+user.fullname:getFirstname]]


        In fact when I do a

        [[!+user.fullname:getFirstname=`1`]]


        and a return $options, the placeholder outputs a 1 so I know the output modifier is being parsed.
          • 23510
          • 168 Posts
          [[!+user.fullname:ucase]]


          doesn’t work either, so it seems output modifiers do not work with the Login.Profile’s placeholders. Its either a bug, or it should mention something in the documentation.

          Will find another way to grab the Firstname and lastname.
            • 3749
            • 24,544 Posts
            It may have to do with the parsing order.

            You should be able to do it the old-fashioned way (which should be more efficient anyway):

            [[!getFullName &inputName=`[[!user.fullname]]`]]


            You’ve probably thought of this, but you might want to adjust the code to consider users with middle names, initials, and suffixes (Peter J. Gordon, III).
              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
              • 23510
              • 168 Posts
              Yeah, it’s a good idea....thanks for your help!