Forum Academy Marketplace Showcase Pricing Features

Giving user a "default" role during sign up [SOLVED]

Hi all.
I have two things: User and Role.
User has parameters: name, e-mail and role (type = Role).
I have two roles: “user” and “admin”.

What I need to achieve is: every user that signs up should be given a default role “user” automatically.
But I can’t get how to do it. I tried to search for a role with name “user” - but something wen’t wrong:

What am I doing wrong?

Why are you creating a new thing as a role? Why not just put a text field on each user of Role, and assign a default value upon signup (in the data tab)?

Hello, csblack.
Thank you for your reply.
I thought about that approach, but it seems to me that managing roles as a separate Thing is more convenient way.

Okay, in that case… you’re searching for a list of roles. You need to select one of them. Use Search for Roles:First Item.

Have the two roles been created in your database? And how will they be created in your database when you go live (since the two db’s are different)?

1 Like

Thank you, your answer helped me to find the way to achieve what I need :wink:
Search for Roles:First Item works fine when the role I need is on the first place in the returned list of roles. But let’s imagine that I have 10 roles and I need the fifth.

The way to solve it is to search for Roles with a constraint “unique id” and put the ID of required role. So bubble will return us only one role. And than we just can use Search for Roles:First Item.

P.S. To get my roles from Development to Live I’ll use export/import CSV function. Not sure whether my roles will be imported in Live with the same ID as in Development or not. I’ll check it later.

1 Like