Add 'attendee's' to existing event in database

My users can create “events” and others can click a button to join the event(s). I want to show current users avatar next to the events they joined.

First job is to enable current user to click a button and have their name added to the “events” database entry. I have managed to do this, but the current user’s email is added, whereas I would like their first and last name to be added. Not sure how to do this?

when join button pressed

1 Like

Doesn’t the user data type have a nameFirst and nameLast text fields?

In your workflow you’re adding an actual User - not just a text field from the User.

So you can access all the User data that you have - presumably you store User’s first and last names?

Yes, but when I specify Firstname, the text goes red (it’s orange in image as I am being asked to add another element - there are no elements which make sense so if I leave it then text is red.

name field

How would I add just a text field from the User? See my database below;

I should note that the button to have their name added to the “events” database entry is positioned inside a repeating group (if that makes a difference)?

Yes, see image ;

@darren.james7518

Seems that there is a little bit of confusion here. Let me take a stab at clearing it up a little.

  • An event has attendees which is a field of a list of users. Emphasis on “list”.
  • A user can be added individually to the event as an attendee. Emphasis on “user” as a data type which has fields of different types … among them “first name” and “last name”. Each of type “text”.

Having said this, perhaps getting more familiar with the concepts of how lists are handled in Bubble may be helpful. I will list a video or videos below.

Hopefully, the video/s will convey the concept that a list of “things” is handled via adding/removing things to it. In this case … addding/removing users to the list of users. Or much more specific … adding/removing attendees to a list of attendees … which are in your case … “users” … a very special data type in Bubble :grinning:.

Last … to display a piece of data from the data base to the user interface … in this case … you want to display an attendee (…a user) name, last name and avatar if I am not mistaken. You do this by using text or image elements and building an expression that pulls this data from the database into the text element … or the image element. Example for an image element … attendee’s image … or for a text element … attendee’s first name. Or if they are called users … user’s image and users’s first name.

Please take a look at the following videos that hopefully connect the concepts shared above with a more elaborate explanation :grinning:

And let me throw in this walkthrough (not a tutorial) which may spark further ideas on building an app in a short period of time:

1 Like

That’s fantastic, thank you. I am going to watch these now and have another go at this! Appreciate your detailed and clear advice.

2 Likes

How would I add just a text field from the User?

Why would you want to do that?

It makes much more sense to add the User rather than just text.

If you really want to you could just set the Attendees list to a list of texts, but that will make things way more complicated than they need to be and limit what you can do with the data.

In the image you posted your database is just ‘displaying’ the User’s email address because that’s what you’ve got set as the primary display field for the User datatype. You can set that to any field you like, but it’s only for display purposes in the Data tab of your app. It’s the User data itself that is being stored on the Event attendee list, not just a text field from it.

Yes, but when I specify Firstname, the text goes red (it’s orange in image as I am being asked to add another element - there are no elements which make sense so if I leave it then text is red.

You can’t add ‘first name’ to a list of Users. First name is a ‘text’ type not a ‘User’ type.

If the field type is ‘User’ then you have to add a value that is of the ‘User’ datatype.

It seems that you haven’t quite got your head fully around the concept of datatypes and relational data yet, so it might pay to take a step back, go through the Bubble manual and Tutorials, and videos like the ones @cmarchan has posted above.

Once you understand the basic concepts of how datatypes work, and how one can be connected to others, including in lists, things like this become much easier and intuitive to set up…

In my opinion it’s generally better to work with datatypes rather than texts whenever possible (and definitely for this particular use case), as it will give you much more options for working with the data, plus leaves less room for errors and duplicates etc. so it’s worth investing the time to really understand how the Bubble database works.

1 Like

I watched this video https://www.youtube.com/watch?time_continue=287&v=4BB4mZp_C3Q&feature=emb_logo and I had done exactly as she did, except mine failed.

You are correct in that I haven’t got my head fully around the concept of datatypes and relational data yet. I watched the first video that @cmarchan posted also and in that one, he clicks a radio button and displays a check icon. Perhaps that is how I should solve my issue?

For clarity, I am just trying to copy meetup.com in how they show the current Attendee’s going to an event (image below). I thought I wasn’t able to show the User’s avatars because the Attendee’s listed in the database were showing only the email, but I guess from what you say this isn’t an issue, in other words, I can pull the Attendee’s image or name from the database.

I have a button called “I am going” and when that is clicked I want that current User’s image to be added to the events repeating group like the image below:

This means that I have a repeating group inside another repeating group. I’ve tried every combination and option available! I know I am a novice but I am so lost that I don’t even know what to study with regards to this issue. If you tell me I need to do what the first video that @cmarchan posted explains, then at least I know that is the solution. But, I feel what I am trying to do may be easier than that tutorial?

I have watched the first two videos, thank you. Would you mind seeing my recent post (before this) as it explains what I am trying to achieve more clearly. I think I incorrectly assumed that I needed to populate the Attendee’s field in the database with the name or I wouldn’t be able to extract the users image/name later on.

@darren.james7518

That is a great video for styling the stacked avatars, but I am nowhere near to that point because I can’t event get one image showing. I need someone to tell me exactly how I would show the image for the attendees who have joined the group.

I can’t see why this doesn’t work?

That’s correct as the data source - but your current privacy rules don’t allow the current user to see any user data apart from their own.

So you’ll need to get rid of those privacy rules.

Bare in mind that will mess up all your existing user searches, as you’re not using any constraints on those, so as I mentioned before, you’ll be better off changing all those to refer to the current user, rather than searching the database.

Once your privacy tiles are set up correctly, to show the users image inside the cell just use current cell’s user’s image

Thank you, that worked! I didn’t even know about the privacy rules. For ref, all I had to do was check the “Find this in searches” field.

Ugh, now all my other images don’t show up. I know you said “Bare in mind that will mess up all your existing user searches, as you’re not using any constraints on those, so as I mentioned before, you’ll be better off changing all those to refer to the current user, rather than searching the database.”

but I don’t understand what that means :frowning:

UPDATE: I have restored the other images throughout the website and now back to square 1, the avatars are not showing again on home page. My privacy is set so that Everyone can see images so not sure what the issue is?

UPDATE 2: I have accidentally deleted all the privacy settings and now I am confused. This should be simple, I just want ALL data (apart from email) to be viewable by everyone (both logged and or out).

https://bubble.io/page?type=page&name=dashboard&id=vdfgfdg&tab=tabs-3&subtab=Privacy

I’ve got the images back but now avatars don’t work again. Add/remove attendee from database buttons no longer work but I know they are coded correctly?

You probably don’t need any privacy rules on your user data type, so just delete the privacy rules entirely (you can always add some more specific rules later if you need them).

Looking again at your app, you’re still not using any constraints on your searches, or specifying which item from the returned results you’re trying to show.

I’ve mention this before, but to show (for example) the current users image, you just use current user’s image

There’s no need to do a search for users there at all, but if you do you need to specify which user you want to refer to.

Currently you’re just searching for ALL users, with no constraints, and no specific item from the returned list. That’s why things aren’t working.

So anywhere in your app you want to refer to the current users data, just refer directly to it.

Previously it may have been working as you were relying on very strict privacy rules in your user data to limit the search results only to the current user.

But now, for what you’re trying to do, you need to relax those privacy rules (or get rid of them entirely) so your searches as they are won’t work.

But as I said, you don’t need to use searches at all to display the current users data.

Also, you’re doing searches inside the RG cells, which is not going to work - the search (if there needs to be one at all) should be done on the data source of the RG, not inside the cells.

Inside the cell you should just refer to the current cells data, otherwise you’ll get the same data inside every cell.

What you’re trying to do should be simple if your database is set up correctly and you privacy rules allow it:

The first RG should have a content type of Event, with the data source being a search for events, with whatever constraints you want to apply.

The second RG should have a content type of User, with the data source being the current cell’s event’s attendees

The image inside that RG should be set to current cell’s user’s image

That’s all you need to do.

This option is not available to me. I can make the data source current cell’s user and then it offers more options which end up failing.