function invite_notifications_entity_insert in Invite 7.4
Implements hook_entity_insert().
File
- modules/
invite_notifications/ invite_notifications.module, line 163 - Main file for the Invite Notifications.
Code
function invite_notifications_entity_insert($invite, $type) {
if (!empty($invite->invitee) && $invite
->status() == INVITE_VALID) {
$message = array(
'iid' => $invite->iid,
'uid' => $invite->invitee,
'inviter' => $invite->uid,
'invitee' => $invite->invitee,
'message_type' => 'registered_user_notification',
);
// Flag the inviting user, this triggers status notifications and
// saves us some queries otherwise.
if (drupal_write_record('invite_notifications', $message) == SAVED_NEW) {
user_save($invite
->invitee(), array(
'data' => array(
'notification_received' => TRUE,
),
));
}
}
}