I am trying to combine the Invite and Facebook Invite together, so that I can give points to inviters who send an invitation using either one of them. And I also use User Relationship to keep the "inviter-invitee" data out of these two modules.
I can Invite people via Facebook,
I can also use rule "UserA accepted UserB Facebook Invite" to give points to the "inviter".
What I need is to create a "user relationship" between UserA and UserB (Setting UserB as Inviter)
But the only USER argument I get on an action is of UserB. So;
- I can't give UserA any points for registering via Invitation, or do something else about "UserA"
- I can't create a relationship with UserA and UserB since I don't know the uid of UserA
Any suggestions?
Comments
Comment #1
Dave Cohen commentedAre you using fb_friend.module to display an invite form? If so, implement hook_fb_friend() and look for $op==FB_FRIEND_OP_REQUEST_ACCEPT. You'll be passed a bunch of data, but to tell the truth I'm not sure that data will have everything you're looking for. Hopefully it already does but if not a patch to fb_friend.module could probably get the data.
Comment #2
orkutmuratyilmazsubscribing.
Comment #3
TS79 commentedhi, the invite stuff seems to be a bigger problem.
first, i think, that the accept trigger is implementet faulty (copy paste error):
the trigger is called, when invitee entered the invite-accept page. so global user, which is input argument for the trigger in fb_rules_fb_friend() for ($op == FB_FRIEND_OP_REQUEST_ACCEPT), is the invitee-user-object and not the inviter. the code is copied from case ($op == FB_FRIEND_OP_REQUEST_SUBMIT), where global user really is the inviter (who submitted the invitation).
the next problem: when a invitee entered the invite-accept page, it is always a anonymous drupal user. so this user-object gives no information about any invite relationship.
further, at accept time, you even can not identify the fbuid / the facebook user id of your invitee.
if any invitee, who has not an account at your drupal-page which is connected to facebook, enters fb_friend_request_accept_page(), you get fbuid= 0 from fb_facebook_user().
so you do not know the facebook-user id and therefore you can not determine the inviter from fb_friend table.
fb_facebook_user() only delivers any fbuid, if the user has added your application (canvas or connected page). i did not get it working with a canvas page, when the user did not add the app before.
now, we assume, the user registeres without facebook connect/adding the app. then you still can not match the new user (former invitee) to any invite realtionship. there are no facebook-uid's available after simple user registration. and only these fbuid's of the invitees are store in fb_friend table.
the first time you can match anything, is when the new user adds you app. then you can do any lookup in fb_friend table and determine any facebook-inviter, if there was one. (but may be there was a regular mail invitation meanwhile, which triggered the user registration...; or may be there is more than one inviter)
so in conclusion, the invite matching works best, if user can only register to your site via facebook connect. you immediately have hte fbuid of the invitee and can determine the inviter from fb_friend table.
Comment #4
georgehatz commentedGot any solution on this?
Comment #4.0
georgehatz commentedforgot the question.
Comment #5
orkutmuratyilmaz