We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37108
    • 80 Posts
    I've got a subscription-only site I'm developing where certain fields outside of those provided by modUser are needed. I've temporarily used extended fields for custom data such as: company, subscription_start (date), subscription_term, etc. I find this too fragile a way of handling the input (i.e., it's too easy to delete not only important data, but the data field all together), and it's a bit unintuitive for the client. Ideally this data would be able to be added within the general information tab ... perhaps even splitting out the subscription criteria on its own tab.

    Also to be considered is that a component is being built to allow users to register for trial access to the site using a special registration code. These codes are to be given out to specific prospects (or groups of prospects), having varying expiration dates and the ability to restrict the number of times a code can be used (seats). So, my front-end login will need to check for the status of the user (are they a regular user or are they a they a trial user?). If they are a trial user, their associated code will be checked against for validity.

    All this background is given because I'm grappling with the idea of extending modUser. I've read that it sometimes more appropriate to just add a custom table (but am not sure how you'd cascade changes [i.e., deletions] made in the modUser table). What's the best route?
      • 4172
      • 5,888 Posts
      extending the modUser with an additional table is the best option in your situation.
      composite - joined records of your extended-table will get automatically deleted, when user-records are deleted, as long as you are working with xpdo for all actions.

      If it was me, I would build my own usermanagement-CMP with help of MIGXdb.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 9102 ☆ A M B ☆
        • 318 Posts
        I'll second what Bruno said, it sounds like you should extend modUser. There are good documents on how to do that here: http://rtfm.modx.com/revolution/2.x/developing-in-modx/advanced-development/extending-moduser, and you could have a look at my Webinex extra https://github.com/freejung/Webinex for an example. I extended modUser with a new class called Prospects in order to connect them to several other tables. It works great and makes it very easy to access your custom data.
          • 37108
          • 80 Posts
          Thanks for the input. My next question: Is it possible to build on top of (or somehow extend) the built-in user editing form to add my custom fields, or do I really need to replicate what exists and add to that (under a new menu item)? [ed. note: smg6511v2 last edited this post 13 years ago.]
            • 3749
            • 24,544 Posts
            It's possible to add new fields to the user form with a plugin tied to OnUserFormRender. It's very easy to add them at the end of the form, though theoretically, you could inject them anywhere with a little extra code.

            You can save them in a plugin tied to OnUserFormSave.

            Shameless Plug: There's an example of both in my book (p. 492): http://amzn.to/Qfsl1Z
              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
              • 37108
              • 80 Posts
              I'm back to focusing on this subject ... next, is it possible to alter the initial manage users page (without hacking core files)? I'd be looking at adding one or two of my extended user fields and removing the id listing.
                • 39404
                • 175 Posts
                stalemate resolution associate Reply #7, 12 years, 10 months ago
                Quote from: smg6511v2 at Nov 09, 2013, 09:07 PM
                I'm back to focusing on this subject ... next, is it possible to alter the initial manage users page (without hacking core files)? I'd be looking at adding one or two of my extended user fields and removing the id listing.

                I think it would be easier to create your own page and then using security (i.e. ACLs) you could hide it from users.

                As for Bob's "shameless plug" the book is well worth it.
                  • 37108
                  • 80 Posts
                  Thanks for the reply. BTW, Bob's book is unavailable (and has been for a while) from Amazon. Anyone know if another batch is being produced?
                    • 4172
                    • 5,888 Posts
                    Here's a simple example for a MIGXdb-CMP, which can manage modUsers.
                    You can simply configure your own form within the MIGX-configurator.
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      You can get BobRay's book from other sources, such as Barnes and Noble
                      http://www.barnesandnoble.com/w/modx-bob-ray/1106819231?ean=9780983619406

                      There is another book available by W. Shawn Wilkerson as well, that is also quite good.
                      http://www.amazon.com/MODX-Revolution-Building-Management-Framework/dp/0985853204
                        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