function ginvite_user_insert in Group 7
Implements hook_user_insert().
Converts e-mail invites into fully qualified invites.
File
- modules/
ginvite/ ginvite.module, line 94 - Contains invite functionality for the Group module.
Code
function ginvite_user_insert(&$edit, $account, $category) {
// Convert all invites for the registered e-mail address.
foreach (ginvite_get_invites($account->mail) as $invite) {
$values = array(
'gid' => $invite->gid,
'uid' => $account->uid,
'roles' => unserialize($invite->roles),
'status' => 'invited',
'invited_on' => $invite->invited_on,
'invited_by' => $invite->invited_by,
);
// Create and save the membership.
$group_membership = entity_create('group_membership', $values);
$group_membership
->save();
}
// Delete the invites from {group_invite}.
db_delete('group_invite')
->condition('mail', $account->mail)
->execute();
}