コード例 #1
0
 /**
  * Process the bulk actions
  *
  * @access public
  * @since 1.4
  * @return void
  */
 public function process_bulk_action()
 {
     $ids = isset($_GET['payment']) ? $_GET['payment'] : false;
     $action = $this->current_action();
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     if (empty($action)) {
         return;
     }
     foreach ($ids as $id) {
         // Detect when a bulk action is being triggered...
         if ('delete' === $this->current_action()) {
             edd_delete_purchase($id);
         }
         if ('set-status-publish' === $this->current_action()) {
             edd_update_payment_status($id, 'publish');
         }
         if ('set-status-pending' === $this->current_action()) {
             edd_update_payment_status($id, 'pending');
         }
         if ('set-status-refunded' === $this->current_action()) {
             edd_update_payment_status($id, 'refunded');
         }
         if ('set-status-revoked' === $this->current_action()) {
             edd_update_payment_status($id, 'revoked');
         }
         if ('set-status-failed' === $this->current_action()) {
             edd_update_payment_status($id, 'failed');
         }
         if ('set-status-abandoned' === $this->current_action()) {
             edd_update_payment_status($id, 'abandoned');
         }
         if ('set-status-preapproval' === $this->current_action()) {
             edd_update_payment_status($id, 'preapproval');
         }
         if ('set-status-cancelled' === $this->current_action()) {
             edd_update_payment_status($id, 'cancelled');
         }
         if ('resend-receipt' === $this->current_action()) {
             edd_email_purchase_receipt($id, false);
         }
         do_action('edd_payments_table_do_bulk_action', $id, $this->current_action());
     }
 }
コード例 #2
0
/**
 * Trigger a Purchase Deletion
 *
 * @since 1.3.4
 * @param $data Arguments passed
 * @return void
 */
function edd_trigger_purchase_delete($data)
{
    if (wp_verify_nonce($data['_wpnonce'], 'edd_payment_nonce')) {
        $payment_id = absint($data['purchase_id']);
        if (!current_user_can('edit_shop_payments', $payment_id)) {
            wp_die(__('You do not have permission to edit this payment record', 'easy-digital-downloads'), __('Error', 'easy-digital-downloads'), array('response' => 403));
        }
        edd_delete_purchase($payment_id);
        wp_redirect(admin_url('/edit.php?post_type=download&page=edd-payment-history&edd-message=payment_deleted'));
        edd_die();
    }
}
コード例 #3
0
/**
 * Delete a customer
 *
 * @since  2.3
 * @param  array $args The $_POST array being passeed
 * @return int         Wether it was a successful deletion
 */
function edd_customer_delete($args)
{
    $customer_edit_role = apply_filters('edd_edit_customers_role', 'edit_shop_payments');
    if (!is_admin() || !current_user_can($customer_edit_role)) {
        wp_die(__('You do not have permission to delete this customer.', 'edd'));
    }
    if (empty($args)) {
        return;
    }
    $customer_id = (int) $args['customer_id'];
    $confirm = !empty($args['edd-customer-delete-confirm']) ? true : false;
    $remove_data = !empty($args['edd-customer-delete-records']) ? true : false;
    $nonce = $args['_wpnonce'];
    if (!wp_verify_nonce($nonce, 'delete-customer')) {
        wp_die(__('Cheatin\' eh?!', 'edd'));
    }
    if (!$confirm) {
        edd_set_error('customer-delete-no-confirm', __('Please confirm you want to delete this customer', 'edd'));
    }
    if (edd_get_errors()) {
        wp_redirect(admin_url('edit.php?post_type=download&page=edd-customers&view=overview&id=' . $customer_id));
        exit;
    }
    $customer = new EDD_Customer($customer_id);
    do_action('edd_pre_delete_customer', $customer_id, $confirm, $remove_data);
    $success = false;
    if ($customer->id > 0) {
        $payments_array = explode(',', $customer->payment_ids);
        $success = EDD()->customers->delete($customer->id);
        if ($success) {
            if ($remove_data) {
                // Remove all payments, logs, etc
                foreach ($payments_array as $payment_id) {
                    edd_delete_purchase($payment_id, false, true);
                }
            } else {
                // Just set the payments to customer_id of 0
                foreach ($payments_array as $payment_id) {
                    edd_update_payment_meta($payment_id, '_edd_payment_customer_id', 0);
                }
            }
            $redirect = admin_url('edit.php?post_type=download&page=edd-customers&edd-message=customer-deleted');
        } else {
            edd_set_error('edd-customer-delete-failed', __('Error deleting customer', 'edd'));
            $redirect = admin_url('edit.php?post_type=download&page=edd-customers&view=delete&id=' . $customer_id);
        }
    } else {
        edd_set_error('edd-customer-delete-invalid-id', __('Invalid Customer ID', 'edd'));
        $redirect = admin_url('edit.php?post_type=download&page=edd-customers');
    }
    wp_redirect($redirect);
    exit;
}
コード例 #4
0
 /**
  * Process the bulk actions
  *
  * @access public
  * @since 1.4
  * @return void
  */
 public function process_bulk_action()
 {
     $ids = isset($_GET['payment']) ? $_GET['payment'] : false;
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     foreach ($ids as $id) {
         // Detect when a bulk action is being triggered...
         if ('delete' === $this->current_action()) {
             edd_delete_purchase($id);
         }
         do_action('edd_payments_table_do_bulk_action', $id, $this->current_action());
     }
 }
コード例 #5
0
/**
 * Trigger a Purchase Deletion
 *
 * @since 1.3.4
 * @param $data Arguments passed
 * @return void
 */
function edd_trigger_purchase_delete($data)
{
    if (wp_verify_nonce($data['_wpnonce'], 'edd_payment_nonce')) {
        $payment_id = absint($data['purchase_id']);
        edd_delete_purchase($payment_id);
        wp_redirect(admin_url('/edit.php?post_type=download&page=edd-payment-history&edd-message=payment_deleted'));
        edd_die();
    }
}
コード例 #6
0
 /**
  * Process the bulk actions
  *
  * @access      private
  * @since       1.3.4
  * @return      void
  */
 function process_bulk_action()
 {
     $ids = isset($_GET['download']) ? $_GET['download'] : false;
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     foreach ($ids as $id) {
         // Detect when a bulk action is being triggered...
         if ('delete' === $this->current_action()) {
             edd_delete_purchase($id);
         }
     }
 }