Forum Academy Marketplace Showcase Pricing Features

Define user relations

Hello,

I’m building a kind of simple social network site.

I’m building a sequence that allows users to invite others to the app via emails. Once the invitee signs up and accepts the invitation two users are connected.

I’m wondering how to display a list of connected users that have different relationship statuses; sender/ recipient, pending/ confirmed

To do that I create one data type to define all relationships.

First user is the sender, the second user is the recipient (invitee). When the recipient signs up, the relationship type will be updated.

But I don’t know how to correctly select the user IDs to display in my Friend’s list, covering the two scenarios.

In theory, I should create a logic that searches the User ID associated with the current users.

Do you think I should store that information in the Users’ data type, creating two rows strong two different status: pending & connected? Or is there a way to run such logic on the fly?

It’s my second week in bubble dev. I’m relying on your guys :wink:

Thanks!
Ohyoon

  1. When a user invites another user via email, are you creating a new user account for the invited person and subsequently creating the relationship?

If you are, which I believe you probably should, then you can on this relation data type remove the user-first because that user is the one who would have created the relationship and you can access that information by using the ‘creator’ after the relation data type in dynamic expressions.

Then when you want to show in a repeating group the relationships you can

Do a search for relationships and constrain by created by and the status

This is how I would set it up if I was building it

Screen Shot 2020-11-21 at 2.11.31 AM Screen Shot 2020-11-21 at 2.11.22 AM

You could then have two repeating groups, one constrained by pending and the other constrained by confirmed

1 Like

Want thanks for your answer @boston85719!

You’re right, I don’t need to set the first user as it’s captured by default.

In your example, when you Do a search for relationship, how do you search “status = confirmed”? In my case, the statuses stored in DB either pending or confirmed, do not appear / not accepted in the search function after “=”.

When I try it using Option, then I can directly set the status ‘pending’, as it is saved in Option.

I use an option set…if you look at the first screen shot in my response you will see it is of an option set called relationship-status…then look at the second screen shot and you will see the data type relationships uses the option set relationship-status as the type of data for the status field…that is how you can see the confirmed after status =

Thanks for clarifying!