function fb_rules_fb_friend in Drupal for Facebook 7.3
Same name and namespace in other branches
- 6.3 contrib/fb_rules.module \fb_rules_fb_friend()
Implementation of hook_fb_friend().
See also
modules/fb/contrib/fb_friend.module
File
- contrib/
fb_rules.module, line 38 - Rules integration for the Drupal for Facebook module.
Code
function fb_rules_fb_friend($op, $data, &$return) {
global $user;
$fb_app = isset($data['fb_app']) ? $data['fb_app'] : NULL;
$fb = isset($data['fb']) ? $data['fb'] : NULL;
// TODO: info on inviter/invitee, $data['fb_friend']
if ($op == FB_FRIEND_OP_REQUEST_SUBMIT) {
if (isset($data['ids']) && count($data['ids'])) {
// User submitted FB invitation
rules_invoke_event('fb_invite_submitted', $user);
// Trigger 'fb_invite_submitted' rules
}
else {
// User skip the invitation
}
}
elseif ($op == FB_FRIEND_OP_REQUEST_ACCEPT) {
if (isset($data['ids']) && count($data['ids'])) {
// User submitted FB invitation
rules_invoke_event('fb_invite_accepted', $user);
// Trigger 'fb_invite_submitted' rules
}
else {
// User skip the invitation
}
}
}