Show some of the user's information

Hi!

So I made a real estate app where you can rent or buy properties.

Inside each property, besides seeing all its details, I want to display who’s the owner and have the ability to click on it and see some of his information.

I’ve tried using a Collection linked to the users tab but it shows the profile of the signed-in user (I guess this is because the Users tab is user-specific, right?), so I tried linking the properties tab and filtering it to show just the properties the owner has, but it’s not working.

Can someone help me with this?

Thanks a lot.

In your Properties table, create a column that you can use for the Property Owner. Ideally this should be either the Owners email or their UserID (RowID) from your Users table. Then create a single relation column that matches Properties->Owner to Users->OwnerID (or email). Then you can add one or more lookup columns that fetch owner details via that single relation, and you will be able to use those values to display on your Property details screen.

And how do I create a UserID column? I have all my data inside Glide (not on google sheets or airtable).

When I create the properties’ collection, if a user has more than one property listed then his profile is displayed more than once, how can I fix this?

Add a RowID column to your User Profiles table. This will auto-populate with a unique value for each row, and be used as a UserID.

Can you describe how you currently have it setup, and/or provide a screen shot?

This screenshot is of the properties detail screen, and you can see where I want to display the Owners profile (this should be clickable and should open the users details and information).

The second screenshot is of the Properties’ Table, where I have the Owner’s name (Column “Anunciante”), a relation between the owner’s name and the user’s name, and then the lookups of some of the user’s information.

The Page is in spanish, I apologize.

Okay, it looks like you need to add a filter to that Collection (under Options) so that only data for the current property is listed. Something like “NombrePropiedad is Screen->NombrePropiedad”.

It would probably be simpler to use something like a Title component to display the owner details, and then you wouldn’t need to bother with a filter.

Ok this actually worked!

The only thing though is that I can only see the user’s profile picture and his information if I’m signed in as the owner of that property. Otherwise, it’s just blank (see screenshots below).

Captura de Pantalla 2022-10-10 a la(s) 15.44.33



That’s most likely because you are using Row Owners in your User Profiles table.

We could get into a big long discussion about whether or not you need that, and how to work around it, but I’d recommend having a read of the related docs first…

Thanks for the info and the documentation.

I read it and in this case I actually need to have row owners because in the future hopefully this app will store personal and sensitive information.

So, since the data for this Page is entirely inside of Glide, how can I mirror the user’s information that I want to make public?

Okay, so here is where it gets a little bit complicated, so please bear with me and I’ll try and explain as best I can.

What you will need to do is create a separate “Public Users” table that contains only the information that you want to make public. And because you’re using Glide Tables only, the arrayformula method mentioned in the docs isn’t available.

Probably the simplest method with Glide tables is to create a simple onboarding flow, and at the end of the flow have your Users click a button to continue. And you need an action attached to that button that does an Add Row action, creating a new row in your Public Users table with that users public information. When creating that row, you should be able to use User Profile column values to populate all columns.

And then with the relation that you created earlier, instead of matching a value in your User Profiles table, you would match a value in your Public Users table.

The other thing that you’ll need to take care of is keeping your Public Users table in sync with your Users table. For example, if one of your users changes their profile image, you’ll want that to be reflected in your Public Users table.

The way to do this is to create a single relation column that matches Users->UserID to Public Users->UserID. And then anywhere in your App where you allow a user to edit their profile, you’ll need an action that does a Set Column Value via that relation, setting the new values in the Public Users table.

@Daniel_Jimenez_Peral - this is a situation that comes up quite often, so I decided to create a simple concept app to demonstrate how to do it. You can find it below:

The example uses an App, but the exact same concept can be applied to Pages.

WOW!

Darren, thank you so much for everything you’ve done to help me!

I think I found a solution based on what you recommended.

This is what I did.

My page is public and has optional sign-in.

When a user wants to publish a property, they have to sign in and update their profile, so I have a sign in button and then an update profile button. The latter is set up that when they submit their information, their information is updated in the users tab (which is private -it has Row owners) and it also adds a row to a Public Users table with the information that I want to have open for other users to see.

By doing this, I managed to display a collection with the user’s public information for each property advertised.

I believe this is exactly what I needed and I’ve tested the app and it’s working… what do you think? Am I missing anything?

Yep, that’s 90% of it.

The only other thing you need to deal with is keeping the two tables in sync…

Oh, and you’ll also need to make sure that what you have doesn’t result in duplicate rows in your Public Users table. So you should have some logic with your Add Row action that causes it to only add a new row if one doesn’t already exist.

Didn’t think of that!

What I did was that when the user updates his profile for the first time, it adds a row to the Public Users tab, but if they update their profile once more afterwards, it only updates the Users Tab (the one with the private info).

Yep, that sounds like it will do the trick :+1:

1 Like

Once again Darren, THANK YOU!

Thanks for all your help!

1 Like

Would you mind helping me with something else?

I’m trying to add a custom domain that I have with Go Daddy. I’ve added both DNS changes Glide asks me but I keep getting an error with one of them:

Is as though there are 2 records with the same info, but I’ve checked and in Go Daddy I only have one of them.

Would you mind creating a separate topic for this one please?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.