We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40088
    • 708 Posts
    Revo 2.6.2

    I used ClassExtender to create several new User Profile fields, and as I understand it that requires adding the following two properties to the Register call:
    [[!Register?
     	&postHooks=`ExtUserRegisterPosthook`
     	&useExtended=`0`
            ...
    ]]

    Am I correct that "useExtended=0" prevents extended fields from being added to the "Extended" tab of the user profile page? Because as far as I can tell that seems to be exactly what's happening when someone registers.

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

      Todd
      • 38783
      • 571 Posts
      I am not sure if it makes a difference but when I have done this I have all my fields first, followed by the instruction not to use Extended and then the posthook...

      [[!Register?
              ...
              &useExtended=`0`
              &postHooks=`ExtUserRegisterPosthook,    
      ]]
        If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

        email: [email protected] | website: https://andytough.com
        • 40088
        • 708 Posts
        Thanks Andy, I'll follow your suggestion.

        Generally speaking I'm never certain if and/or when the property order matters, regardless of snippet. Yet I always seem to get caught out every now and then. Some rules or guidelines regarding property order would not go amiss.

        Anyway, getting back to my original question. I'm asking about useExtended=0 because I'm using a customized TW responsivePersonalConfig Chunk to personalize the RFM folder message.

        It grabs the extended field (firstName) for the message.
        $myProfile = $modx->user->getOne('Profile');
        $myProfile = $myProfile->get('extended');
        $myProfile = $myProfile['firstName'];
        $folder_message = "Hi " . $myProfile . " This is your custom media folder...
        ...

        It was working fine when I was only using User > Extended Fields.

        The problem now is this (when using ClassExtender with Register):
        The useExtended=0 property in the Register (and UpdateProfile) calls prevent the firstName (and other fields) from being saved in User > Extended Fields which is where the above code looks for the firstName value. Hence it's not being displayed in the RFM message.

        Assuming useExtended=0 and postHooks=ExtUserRegisterPosthook are in fact required when using ClassExtender fields, then my question is simply this:

        How can I grab the firstName value from the ClassExtender field and use it in the custom RFM folder message (above)? [ed. note: todd.b last edited this post 6 years ago.]
          Todd
          • 38783
          • 571 Posts
          I don't have any first hand experience of doing that, but assuming the data collected with the registration form is being placed in the correct classExtender user field then I think Bob's documentation on his own site might cover what you are asking here.

          https://bobsguides.com/classextender-class.html
          The section that might help has the heading 'Your Own Code'.

          [ed. note: andytough last edited this post 6 years ago.]
            If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

            email: [email protected] | website: https://andytough.com
          • discuss.answer
            • 3749
            • 24,544 Posts
            I think this is what you want (untested):

            $data = $modx->getObject('userData', array('userdata_id' => $modx->user->get('id')));
            $firstName = $data->get('firstName');
            $folder_message = "<strong>Hi " . $firstName . "</strong>, this is your custom media folder...
              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
              • 40088
              • 708 Posts
              Thanks Andy and Bob.

              Bob, it works perfectly.

              Thank you.
                Todd
                • 3749
                • 24,544 Posts
                Glad I could help. smiley
                  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