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.
-
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
-
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.
-
MODX Staff
- 2,502 Posts
What OpenGeek said.
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
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.
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