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 need to add several fields to the user profile page of a specific user-group. The tutorials I've been able to find so far haven't been much help in explaining how to use the Extended Fields page. Can someone point me towards a good reference?

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

      Todd
    • discuss.answer
      • 3749
      • 24,544 Posts
      One option is to use ClassExtender, which basically creates an extra user profile with whatever fields you need and adds them to the Create/Edit user form in the Manager, or to a front-end form with the UpdateProfile snippet. It's much faster and usually easier than using the built-in extended field in the user profile.

      http://bobsguides.com/blog.html/2014/05/27/why-extend-moduser/

      http://bobsguides.com/classextender-class.html
        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
        Interesting, Bob. A couple questions:

        1. Can I extend just the modUser and not the modResource, or are both required?
        2. Once I create the new fields can I delete the two Resources or are they still required?
          Todd
          • 3749
          • 24,544 Posts
          Yes, you can extend only one of the two, or both.

          You should be able to delete the resources, but you can't uninstall ClassExtender.

            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
            Great. Thanks, Bob.

            I hope v3.0 improves upon the tedious and vague process of using the native User Profile Extended Fields. The info I found kinda made my eyes glaze over.
              Todd
              • 3749
              • 24,544 Posts
              I hope v3.0 improves upon the tedious and vague process of using the native User Profile Extended Fields.

              I agree completely, although it's not all that complicated. It's just horrible for searching and sorting.

              You can think of the extended field as a PHP associative array. It's stored as a JSON string in the DB (that's why it's so useless for searching and sorting), but it's automatically converted to an associative array when you get it with $profile->get(), and automatically converted to a JSON string when you call $profile->set().

              Another failing is that when you add a new extended field for a user in the Manager, it doesn't add that field for other users. You have to go through the process for each user (or use a utility snippet to update all of them).

                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
                I agree completely, although it's not all that complicated. It's just horrible for searching and sorting.

                Then let me ask you this: If all I need to do with these extra User profile fields is auto-populate a few TVs on the front-end, is there really any performance hit in using the native Extended Fields? That seems pretty basic.
                  Todd
                  • 3749
                  • 24,544 Posts
                  If you never need to search for users (or sort them) by the content of the extended fields, or by the content of the TVs, there's not much of a hit.

                  Using ClassExtender would likely replace the TVs as well as the extended fields.




                    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