How do you tie a user to their data?

For example, if I have a user table and then a posts table, how do I tie the user to their data so I can easily access data only for a specific user?

Like their blog posts or video posts, their photo posts etc…

Are there any good tutorials on how to do this?

1 Like

When I create message boards, I will have a Message Object variable, which contains some data besides just the message, such as date/time, and user-id (UID). So a very simple message post object might look like this:

PostObject {
Message
DateTime
UID
}

The UID identifies the user who created the post, which you can use to reference your table elsewhere like a user details screen.

Thats the basic concept anyway.

1 Like

Depends on the structure of your backend and some personal taste I would say.

What I personally do is:

  • Have an Object for every user in the database
  • Add all necessary attributes as data fields to the user object (like name, age, etc)
  • Add additional objects as references or list to the user (like e.g. messages from the user)