We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8609
    • 607 Posts
    I’m trying to figure out the most efficient way to accomplish this. I need to have each user that registers have a specific page assigned to them that they can edit to their hearts content. Additionally, I would like the user to only be able to see their own individual page in the site tree and not any other pages. It would be fantastic if this page could be created automatically when the user registers.

    My first naive approach is to have each user in a group of his own and then assign one resource group (the users page) to each user group. However, I imagine this will get quite cumbersome as the number of users increase (e.g. 50 user groups for 50 users and 50 resource groups etc). Additionally, how do I make it so the user group and specific user page are created automatically as soon as the user registers for an account? I don’t mind going in and setting the permissions manually since the resources will be unpublished by default.

    My second thought is to just have the information pertinent to the user in the user profile instead of creating a separate user page. However, in this case it means I would need to add custom fields to the user settings (how to do this?), and then display those.

    Any thoughts? I might be making this a lot more complex than it needs to be but I’m a little stumped.
      • 27708 MODX Staff
      • 2,502 Posts
      Mary,

      What about creating a table for the extended user profile data, creating a snippet to to process the form to add/update the fields into a dynamically based page view that uses the logged in user as the request.

      So you’d have a snippet to show/edit/
      A Document with the snippet call and the placeholders/form for edit update.
      A Snippet to display the list of the documents (based on an url).

      There may be more bits needed but you are more proggie than I.

      Cheers,

      Jay
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
        • 22303 MODX Staff
        • 10,725 Posts
        I personally would create a custom table for the profile data you want to use on the page and then create a single view to render it based on a userid parameter in the query string. Then you could have it detect if the user accessing it is logged in and if so, present a link to another page for editing this data. It would take very little then to implement friendly urls for this view using the username, i.e. profiles/username/ could take them to the user specific page via a plugin OnPageNotFound. At least I believe that would be the most efficient way to implement this in MODx without touching the core or jumping through a lot of hoops.
          • 27708 MODX Staff
          • 2,502 Posts
          What OpenGeek said. tongue
            Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
            • 34017
            • 898 Posts
            hey mary,

            I did something like this recently.

            1. Have a folder called ’User Pages’
            2. Create a template called ’User Page’
            3. Add an input TV called ’user_id’
            4. When a user signs up, create a new document under ’User Pages’
            ... set the TV of user_id to the new user’s id
            ... I used modxApi for this
            5. if the user is logged in, let them see newspublisher snippet for only their page.

            You may want to create a plugin that says if UltimateParent of $modx->documentIdentifer is ’User Pages’, make sure user only edits/views page where tv.user_id == user_id

            This way you can modx document snippets, TVs, plugins, and dont need user groups. And you can edit the user’s info from the backend if needed.

            Edit: What Jason said is great if you want to program. My version is more if you want something without having to do a lot of programming. Either way will work.
              Chuck the Trukk
              ProWebscape.com :: Nashville-WebDesign.com
              - - - - - - - -
              What are TV's? Here's some info below.
              http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
              http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
              • 8609
              • 607 Posts
              Quote from: smashingred at Jan 20, 2010, 01:39 PM

              Mary,

              What about creating a table for the extended user profile data, creating a snippet to to process the form to add/update the fields into a dynamically based page view that uses the logged in user as the request.

              So you’d have a snippet to show/edit/
              A Document with the snippet call and the placeholders/form for edit update.
              A Snippet to display the list of the documents (based on an url).

              There may be more bits needed but you are more proggie than I.

              Cheers,

              Jay

              Jay, thanks, sounds like a good approach, but that will need more Revo chops than I have at the moment. Time to go digging in the docs!! smiley



              Quote from: OpenGeek at Jan 20, 2010, 01:50 PM

              I personally would create a custom table for the profile data you want to use on the page and then create a single view to render it based on a userid parameter in the query string. Then you could have it detect if the user accessing it is logged in and if so, present a link to another page for editing this data. It would take very little then to implement friendly urls for this view using the username, i.e. profiles/username/ could take them to the user specific page via a plugin OnPageNotFound. At least I believe that would be the most efficient way to implement this in MODx without touching the core or jumping through a lot of hoops.

              Jason, that sounds exactly like what I’m after. On the surface it sounds very straightfoward (but then it usually rarely is). OK, when you say create a view, I understand what that means in the context of something like the Zend Framework or CI, etc. But I’m a little fuzzy when it comes to the equivalent of this in MODx.
                • 8609
                • 607 Posts
                Quote from: ChuckTrukk at Jan 20, 2010, 01:56 PM

                hey mary,

                I did something like this recently.

                1. Have a folder called ’User Pages’
                2. Create a template called ’User Page’
                3. Add an input TV called ’user_id’
                4. When a user signs up, create a new document under ’User Pages’
                ... set the TV of user_id to the new user’s id
                ... I used modxApi for this
                5. if the user is logged in, let them see newspublisher snippet for only their page.

                You may want to create a plugin that says if UltimateParent of $modx->documentIdentifer is ’User Pages’, make sure user only edits/views page where tv.user_id == user_id

                This way you can modx document snippets, TVs, plugins, and dont need user groups. And you can edit the user’s info from the backend if needed.

                Edit: What Jason said is great if you want to program. My version is more if you want something without having to do a lot of programming. Either way will work.

                Thanks!! Will give this a shot too.
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Quote from: einsteinsboi at Jan 20, 2010, 02:01 PM

                  Jason, that sounds exactly like what I’m after. On the surface it sounds very straightfoward (but then it usually rarely is). OK, when you say create a view, I understand what that means in the context of something like the Zend Framework or CI, etc. But I’m a little fuzzy when it comes to the equivalent of this in MODx.
                  A view, as I am using the word here, is a Resource in MODx with some Snippets (and/or other Elements) on it to produce a view of some data.
                    • 20413
                    • 2,877 Posts
                    ShowMembers + webprofile snippet needs to be converted to Revo.
                    And a plugin like this: http://modxcms.com/forums/index.php/topic,25087.msg154585.html#msg154585
                      @hawproductions | http://mrhaw.com/

                      Infograph: MODX Advanced Install in 7 steps:
                      http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                      Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                      http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                      • 8609
                      • 607 Posts
                      Quote from: OpenGeek at Jan 20, 2010, 02:06 PM


                      A view, as I am using the word here, is a Resource in MODx with some Snippets (and/or other Elements) on it to produce a view of some data.

                      Gotcha!! Thanks smiley