How to Allow Users to Follow Others
Last updated
Last updated
If your app has a social element where users can follow one another, check out this tutorial. This tutorial starts with a View User's Profile screen already created. To learn more about how to create profile screen, you can review the How to set up a Public Profile screen for Users tutorial.
Open the Database section on the left toolbar.
Select the drop down arrow to expand the Users data table.
Select + ADD PROPERTY.
Hover over Relationship.
Select Users.
Select the option that states "A User can have multiple Users. A User can have multiple Users".
Select Done.
Back on the left toolbar, in the red box for the Users relationship select the Name field where it says Users.
Delete the text Users and rename it to Following.
Select Save
Open the Database section on the left toolbar.
Select the drop drop down arrow to expand the Users data table.
Select + ADD PROPERTY.
Hover over Relationship.
Select Users.
Select the option that states "A User can have multiple Users. A User can have multiple Users".
Select Done.
Back on the left toolbar, in the red box for the Users relationship select the Name field where it says Users.
Delete the text Users and rename it to Followers.
Select Save
Select the add component button
Select Text.
Place the text on the screen.
On the left toolbar, place your cursor in the grey box under, where it says Enter Text.
Delete the text.
Type in "Follow?"
Select the add component button
Scroll down to the Buttons section and select it to expand the menu.
Select the Toggle component.
Place the toggle on the screen.
Under What does this trigger?, select Logged in User > Following > Includes Current User?.
Select the Toggle.
On the left toolbar, scroll down to the Click Actions section and select + ADD ACTION.
Select Update > Current User.
In the Update section that just appeared in the left toolbar, scroll down to Followers and select the drop down arrow.
Select ADD > Logged In User.
Select Show Advanced.
Under When does this happen? Select the drop down arrow where it says Always and change it to Sometimes.
Underneath where it says This Action will only happen if... select the drop down arrow next to where it says Select.
Set it to Current User > Followers > All
Next to where it says Contains, select the drop down arrow.
Select Does not contain.
For the last value of the condition, where it says Empty, select the drop down arrow and set it to Logged in User.
Select Done.
Select the Toggle.
On the left toolbar, scroll down to the Click Actions section and select + ADD ACTION.
Select Update > Current User.
In the Update section that just appeared in the left toolbar, scroll down to Followers and select the drop down arrow.
Select Remove> Logged In User.
Select Show Advanced.
Under When does this happen?, select the drop down arrow where it says Always and change it to Sometimes.
Underneath where it says This Action will only happen if... select the drop down arrow next to where it says Select.
Set it to Current User > Followers > All
The next field will auto populate as Contains. Leave that as is.
For the last value of the condition, where it says Empty, select the drop down arrow and set it to Logged in User.
Select Done.
On the left toolbar, select the Add Component button.
Select Button.
Place it on the screen.
On the left toolbar underneath where it says Text, select the text Button and removed it.
Add the text Follow.
Select the follow button.
On the left toolbar, underneath Click Actions, select + ADD ACTION.
Set the action to Update > Logged In User
In the Update section that just appeared in the left toolbar, scroll down to Following and select the drop down arrow.
Set it to Add > Current User.
Select Done.
Select the follow button.
On the left toolbar, underneath Click Actions, select + ADD ANOTHER ACTION.
Set the action to Update > Current User
In the Update section that just appeared in the left toolbar, scroll down to Followers and select the drop down arrow.
Set it to Add > Logged In User.
Select Done.
Select the Follow button.
On the left toolbar next the where it says the name of your button, select the overflow menu.
Select Change Visibility.
On the left toolbar in the Visibility section, select the drop down arrow next to where it says Always Visible.
Set it to Sometimes Visible.
Underneath where is says Will be visible if... select the drop down menu.
Set it to Logged in User > Following > All.
Next to where it says Contains, select the drop down arrow.
Select Does not contain.
For the last value of the condition, where it says Empty, select the drop down arrow and set it to Current User.
Select Done.
On the left toolbar, select the Add Component button.
Select Button.
Place it on the screen.
On the left toolbar underneath where it says Text, select the text Button and removed it.
Add the text Unfollow.
Underneath where it says Icon, select the x to remove the icon that is in place.
Select the drop down menu.
Select an icon that you would like to use. In this situation, I chose to use the cancel icon.
Select the Unfollow button.
On the left toolbar, underneath Click Actions, select + ADD ACTION.
Set the action to Update > Logged In User
In the Update section that just appeared in the left toolbar, scroll down to Following and select the drop down arrow.
Set it to Remove > Current User.
Select Done.
Select the follow button.
On the left toolbar, underneath Click Actions, select + ADD ANOTHER ACTION.
Set the action to Update > Current User
In the Update section that just appeared in the left toolbar, scroll down to Followers and select the drop down arrow.
Set it to Remove > Logged In User.
Select Done.
Select the Unfollow button.
On the left toolbar next the where it says the name of your button, select the overflow menu.
Select Change Visibility.
On the left toolbar in the Visibility section, select the drop down arrow next to where it says Always Visible.
Set it to Sometimes Visible.
Underneath where is says Will be visible if... select the drop down menu.
Set it to Logged in User > Following > All.
The next field will auto populate as Contains. Leave that as is.
For the last value of the condition, where it says Empty, select the drop down arrow and set it to Current User.
Select Done.