I'm inviting friends in the following manner:
FB.ui({method: 'apprequests', message: message, to: inviteTokens}, onInvite);
I save the ids received in the "to" field of the callback response and associate them with the inviter in the database.
Then when one of the invitees connects to the app for the first time, I can match his id to the ids previously fetched from the "to" field, and reward the inviter accordingly.
The problem is, I have to loop over the entire users in the database in order to find who invited this id. I can create a special table for invitations to be able to find a match more easily, but it seems like an overkill.
Would it be possible to pass the inviter's id in the FB request, so that when the invitee logs in for the first time I can immediately see who invited him?
Aucun commentaire:
Enregistrer un commentaire