/**
  * Handle subscription cancel request from the user
  *
  * @return WPUF_Subscription
  */
 public function user_subscription_cancel()
 {
     if (isset($_POST['wpuf_cancel_subscription'])) {
         if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'wpuf-sub-cancel')) {
             wp_die(__('Nonce failure', 'dps'));
         }
         $user_id = get_current_user_id();
         $current_pack = self::get_user_pack($user_id);
         if ($current_pack['recurring'] == 'yes') {
             $wpuf_paypal = new WPUF_Paypal();
             $wpuf_paypal->recurring_change_status($user_id, 'Cancel');
         } else {
             WPUF_Subscription::init()->update_user_subscription_meta($user_id, 'Cancel');
         }
         wp_redirect($_SERVER['REQUEST_URI']);
     }
 }
Exemple #2
0
 /**
  * Ajax function. Delete user package
  * @since 2.2.7
  */
 function delete_user_package()
 {
     $wpuf_paypal = new WPUF_Paypal();
     $wpuf_paypal->recurring_change_status($_POST['userid'], 'Cancel');
     echo delete_user_meta($_POST['userid'], '_wpuf_subscription_pack');
     exit;
 }