function invite_by_email_invite_presave in Invite 7.4
Implements hook_invite_presave().
File
- modules/
invite_by_email/ invite_by_email.module, line 153 - Main file for Invite by e-mail.
Code
function invite_by_email_invite_presave($invite) {
if (empty($invite
->type_details()->invite_sending_controller['invite_by_email'])) {
return FALSE;
}
global $user;
$invite_by_email_settings = $invite
->type_details()->data['invite_by_email'];
if ($invite_by_email_settings['use_default'] && variable_get('invite_default_replace_tokens', TRUE) || !$invite_by_email_settings['use_default'] && !empty($invite_by_email_settings['replace_tokens'])) {
$token_data = array(
'invite' => $invite,
'user' => $user,
'profile' => user_load($user->uid),
);
$invite->field_invitation_email_subject[LANGUAGE_NONE][0]['value'] = token_replace(trim($invite->field_invitation_email_subject[LANGUAGE_NONE][0]['value']), $token_data);
$invite->field_invitation_email_body[LANGUAGE_NONE][0]['value'] = token_replace($invite->field_invitation_email_body[LANGUAGE_NONE][0]['value'], $token_data);
}
}