I'm am creating a event listing website like eventbrite.com. There are organizers who can create events and users who can register for events.
Users need to login to the system via Facebook. In this case I get to store their facebook_id.
My question is, how can I get a particular user's friend list (friends who are attending the event) and display below the event?
Actually I have an idea for this:
Solution I
When a logged in user attending an event, I can save his facebook_id with the event id.
Event attenders table
facebook_id | ---- Event _id
42343453424 | ---- 08
34534534544 | ---- 08
23424243224 | ---- 10
When another user logs in, I can get his friends facebook_ids and try to match with the Event attenders table.
Example:
user_friend_list = [ 42343453424 , 23424243224 , 4345345345 , 245345433 ,...etc ]
I have to get the 1st user form the user_friend_list array (42343453424) and search in the Event attenders table, and the second user (23424243224) , and the third user so on.
This method needs to run lots of loops and queries. This will cause a huge delay in the site.
Can anyone please suggest me a better solution of doing this?
Thanks in advance!
-PS
In eventbrite.com and eventful.com and there's a Facebook app that do this work. how to create such a Facebook book app to do this work.
If I have multiple events on my homepage and I want to display the attenders list below each and every event once a user logs in. Is this possible to do smoothly?