Need some help..!

I created an app where users can post something in the text form. so what I’m not able to do is two things i.e.,

  1. How can I set database where I’m able to show the user-posted data to all users who use my app (Logged)

  2. Like system for the text, they (user) posted

Please refer database as A,B & so on.

1 Like

Hiya,

Hopefully this will help.

Step 1. You would need at least the following collections
#1 Users
Where people sign up / login.

#2 Collection B - I will refer to this as Posts
This is the database you should point to when user submit their post.
This collection should have the following properties:

  • Post ID
  • Post (for text they write)
  • Image or some media they upload

Step 2. Go to Collection B and create a relationship property with the Users collection.
This relationship indicates the owner of the post - let’s call this property Posted by.
Users can have multiple Posts, but a Post can have one user.
Everytime you create a record for the Posts collection, you should also update the Posted by with the current logged in user’s user id.

Step 3. Go to Collection B and create another relationship property with the Users collection.
Users can have multiple Posts, and a Post can have multiple users.
This relationship indicates who liked the post - let’s call this property Likes.
You can have a Like button that have action which will update the Post collection to add the logged in user to this Likes column. To show how many likes a post can have, you can use the formula to Count the number of users in the Likes property.

1 Like

Hey thanks for your help but one thing i’m still facing is a logged in user can able to click the icon more than once that means when they like the post more than once it count all the hits .

Icon > Clicks > Update the current record > Likes + 1

Above mention method i’m using for now.

Main thing i’m looking to develop

When user click the icon, the icon will inactive & changed the color.
And if user once again clicked it then back to previous count.

For example -
User clicked > (Collection Property - 10 ) +1 = (Collection Property - 11) >
User once again clickes on the same icon > (Collection Property - 11 ) -1 = (Collection Property - 10)

Hi! I was able to do this by creating two like buttons on top of each other with conditional visibility. I also added a relationship between posts and users and called it ‘likers’ so I could keep track of who liked it. Here’s how it works:

Like Button (unclicked)

  • only visible if likes does not contain logged in user
  • click action: add user to likes

Like Button (clicked)

  • only visible if likes contains logged in user
  • click action: remove user from likes

This way, the button acts like a toggle that changes when you click it. You could make one of them a different color to indicate whether or not it has been clicked yet. Does that help?

Hello Parker,
I am trying to implement this in my app but I keep struggling. Do you think you could please make a short video or more detailed message on how to achieve this? Thanks!

This link is to a simple setup: How to Allow Users to Follow Others - Adalo Resources

If you need something more complex (I’m using an external data source), here is my setup:

2 Likes

The video doesn’t play. Could you upload again?

1 Like

the video works now. good stuff Ajay

Thank you Ajay, great stuff!