function invite_delete in Invite 5
Same name and namespace in other branches
- 5.2 invite.module \invite_delete()
- 6.2 invite.module \invite_delete()
- 7.4 invite.module \invite_delete()
- 7.2 invite.module \invite_delete()
Menu callback; display confirm form to delete an invitation.
Parameters
$origin: String denoting the orginating invite status page.
$code: A registration code to remove the invitation for.
1 string reference to 'invite_delete'
- invite_menu in ./
invite.module - Implementation of hook_menu().
File
- ./
invite.module, line 1063 - Allows your users to send and track invitations to join your site.
Code
function invite_delete($origin, $code) {
global $user;
$invite = invite_load($code);
// Inviter must be the current user
if ($invite->inviter->uid == $user->uid) {
// Verify the invitation may be deleted
if (!$invite->timestamp || user_access('withdraw accepted invitations')) {
$form['invite'] = array(
'#type' => 'value',
'#value' => $invite,
);
$description = !$invite->timestamp && $invite->expiry > time() ? t("The invitee won't be able to register any more using this invitation.") : '';
return confirm_form($form, t('Are you sure you want to withdraw the invitation to %email?', array(
'%email' => $invite->email,
)), "invite/list/{$origin}", $description . ' ' . t('This action cannot be undone.'), t('Withdraw'), t('Cancel'));
}
else {
drupal_set_message(t('Invitations to registered users cannot be withdrawn.'), 'error');
}
}
else {
watchdog('invite', t('Detected malicious attempt to delete an invitation.'), WATCHDOG_WARNING, l(t('view'), 'user/' . $user->uid));
drupal_access_denied();
}
drupal_goto('invite/list');
}