You can store a user’s unique path string in a text field under the User type and then append that as a path to the profile page url. For example “myapp.com/profile/john-henry ” or “myapp.com/profile/naturalfoodstore ”. What you’d be storing is just “john-henry” or “naturalfoodstore”.
So anytime you navigate to the profile page and want to specify a user, you’d use an external link action (or link element) to go to “http://myapp.com/profile/ [current user’s path]” … or [current cell’s user’s path] if triggered from a repeating group.
Then, on the profile page, since you’re using the path to identify the user, one way to make the page dynamic is to put everything in the page inside a group. Set the group’s type to User and the source to “Search for Users: first item, constraint: path = get path from page URL”. Then everything within would just be “Parent groups [field]”
“Get data from page URL” has 2 types available - parameter and path. Choose Path.
Search the forum for more on this because this is a great way to create “pretty” custom URLs.
But for this part:
Set the group’s type to User and the source to “Search for Users: first item, constraint: path = get path from page URL”. Then everything within would just be “Parent groups [field]
I cant seem to do the constraint for the path???
Anyone knows what is going on??? Please i really need help
I tried doing constraint in the “Search for Users” or “filtered” but both dont seem to have the option to start the constraint with Path ??? only the field types i listed for User… Anyways please help!!!1
If I understand correctly, I think what you’ll want to do instead of a Search for Users, filters, etc, is simply setting the User’s individual / unique name as their Slug, and simply setting the page type to ‘User’. Now the URL w/ the user’s Slug at the end of it will automatically load.
okay, i have considered that but what i am trying to do is by referencing the username from the path in the url, identify the user with that username and display their avatar using a dynamic data
Does that make sense?
Right now im trying to get it to search for the correct user based off the path in the URL. Any idea how to?
It does make sense, although the problem with that is you’ll have to setup proper restrictions in place to make sure the username is unique, otherwise this approach won’t work. The Slug workflow takes care of ensuring unique names, and appends with numbers (for example if there’s already a john-smith, it will create john-smith1). Additionally using Slugs you don’t need to setup any sort of ‘do a search for’ parameters - simply having the slug in the URL is all it needs to know what it needs to do.
You should just need ‘Current User’s Avatar’ - the page’s user’s Slug being in the URL and that avatar being on the User’s datatype should be all you need.
but doesn’t current user mean the user who is currently logged into the account? If i need the users to be able to see each other’s profile shouldn’t i need some sort of expression to reference to the slug and display that user’s profile instead?
You are correct, ‘Current User’ means ‘currently logged in user’ - of you need users to see other user’s profile, than instead of Current User, you’d use ‘Current page’s user’.
One last question: when navigating to the profile page, i should send data of the Slug as a path and the avatar display would be current page’s user’s avatar correct?