/** * Process the bulk actions * * @access public * @since 1.4 * @return void */ public function process_bulk_action() { if (empty($_REQUEST['_wpnonce'])) { return; } if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'bulk-discounts')) { return; } $ids = isset($_GET['discount']) ? $_GET['discount'] : false; if (!is_array($ids)) { $ids = array($ids); } foreach ($ids as $id) { if ('delete' === $this->current_action()) { edd_remove_discount($id); } if ('activate' === $this->current_action()) { edd_update_discount_status($id, 'active'); } if ('deactivate' === $this->current_action()) { edd_update_discount_status($id, 'inactive'); } } }
/** * Listens for when a discount delete button is clicked and deletes the * discount code * * @since 1.0 * @param array $data Discount code data * @uses edd_remove_discount() * @return void */ function edd_delete_discount($data) { if (!isset($data['_wpnonce']) || !wp_verify_nonce($data['_wpnonce'], 'edd_discount_nonce')) { wp_die(__('Trying to cheat or something?', 'easy-digital-downloads'), __('Error', 'easy-digital-downloads'), array('response' => 403)); } if (!current_user_can('manage_shop_discounts')) { wp_die(__('You do not have permission to delete discount codes', 'easy-digital-downloads'), __('Error', 'easy-digital-downloads'), array('response' => 403)); } $discount_id = $data['discount']; edd_remove_discount($discount_id); }
/** * Listens for when a discount delete button is clicked and deletes the * discount code * * @since 1.0 * @param array $data Discount code data * @uses edd_remove_discount() * @return void */ function edd_delete_discount($data) { if (!isset($data['_wpnonce']) || !wp_verify_nonce($data['_wpnonce'], 'edd_discount_nonce')) { wp_die(__('Trying to cheat or something?', 'edd'), __('Error', 'edd')); } $discount_id = $data['discount']; edd_remove_discount($discount_id); }
/** * Process the bulk actions * * @access private * @since 1.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) { if ('delete' === $this->current_action()) { edd_remove_discount($id); } } }
/** * Delete Discount * * Listens for when a discount delete button is clicked. * * @access public * @since 1.0 * @return void */ function edd_delete_discount($data) { $discount_id = $data['discount']; edd_remove_discount($discount_id); }
/** * Process the bulk actions * * @access public * @since 1.4 * @return void */ public function process_bulk_action() { $ids = isset($_GET['discount']) ? $_GET['discount'] : false; if (!is_array($ids)) { $ids = array($ids); } foreach ($ids as $id) { if ('delete' === $this->current_action()) { edd_remove_discount($id); } if ('activate' === $this->current_action()) { edd_update_discount_status($id, 'active'); } if ('deactivate' === $this->current_action()) { edd_update_discount_status($id, 'inactive'); } } }