Index: invite.module
===================================================================
--- invite.module	(revision 2883)
+++ invite.module	(working copy)
@@ -157,9 +157,9 @@
     'access callback' => TRUE,
     'type' => MENU_CALLBACK,
   );
-  $items['invite/withdraw'] = array(
+  $items['invite/withdraw/%invite'] = array(
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('invite_cancel'),
+    'page arguments' => array('invite_cancel',2),
     'access arguments' => array('track invitations'),
     'type' => MENU_CALLBACK,
   );
@@ -1180,11 +1180,8 @@
  * @param $code
  *   A registration code to remove the invitation for.
  */
-function invite_cancel(&$form_state, $origin, $code) {
+function invite_cancel(&$form_state, $invite) {
   global $user;
-
-  $invite = invite_load($code);
-
   // Inviter must be the current user.
   if ($invite->inviter->uid == $user->uid) {
     // Verify the invitation may be deleted.
@@ -1199,7 +1196,7 @@
       return confirm_form(
         $form,
         t('Are you sure you want to withdraw the invitation to %email?', array('%email' => $invite->email)),
-        "user/$user->uid/invites/{$origin}",
+        $_REQUEST['destination'],
         $description .' '. t('This action cannot be undone.'),
         t('Withdraw'),
         t('Cancel')
@@ -1213,8 +1210,7 @@
     watchdog('invite', 'Detected malicious attempt to delete an invitation.', array(), WATCHDOG_WARNING, l(t('view'), 'user/'. $user->uid));
     drupal_access_denied();
   }
-
-  drupal_goto("user/$user->uid/invites/$origin");
+  drupal_goto();
 }
 
 /**
Index: invite_admin.inc
===================================================================
--- invite_admin.inc	(revision 2883)
+++ invite_admin.inc	(working copy)
@@ -373,7 +373,7 @@
           $row[] = check_plain($invite->email);
         }
         $row[] = $account_exists ? t('Accepted') : t('Deleted');
-        $row[] = $allow_delete ? l(t('withdraw'), "invite/withdraw/$page/$invite->reg_code") : '';
+        $row[] = $allow_delete ? l(t('withdraw'), "invite/withdraw/$invite->reg_code", array('query'=>drupal_get_destination())) : '';
         $row[] = '';
         break;
 
@@ -383,7 +383,7 @@
 
         $row[] = check_plain($invite->email);
         $row[] = $expired ? t('Expired') : t('Pending');
-        $row[] = l(t('withdraw'), "invite/withdraw/$page/$invite->reg_code");
+        $row[] = l(t('withdraw'), "invite/withdraw/$invite->reg_code", array('query'=>drupal_get_destination()));
         $row[] = $expired ? l(t('resend'), "invite/resend/$invite->reg_code") : '';
         break;
     }
