function invite_cancel in Invite 6.2
Same name and namespace in other branches
- 5.2 invite.module \invite_cancel()
Menu callback; display confirm form to delete an invitation.
Parameters
$form_satate: A keyed array containing the current state of the form.
$origin: A string denoting the orginating status page to return the user to afterwards.
1 string reference to 'invite_cancel'
- invite_menu in ./
invite.module - Implementation of hook_menu().
File
- ./
invite.module, line 1260 - Allows your users to send and track invitations to join your site.
Code
function invite_cancel(&$form_state, $invite) {
global $user;
// Inviter must be the current user.
if ($invite->inviter->uid == $user->uid) {
// Verify the invitation may be deleted.
if (!$invite->joined || user_access('withdraw accepted invitations')) {
$form['invite'] = array(
'#type' => 'value',
'#value' => $invite,
);
$description = !$invite->joined && $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,
)), $_REQUEST['destination'], $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', 'Detected malicious attempt to delete an invitation.', array(), WATCHDOG_WARNING, l(t('view'), 'user/' . $user->uid));
return drupal_access_denied();
}
drupal_goto();
}