public function delete_forms($form_ids) { $this->authorize("gravityforms_delete_forms"); $count = 0; if (is_array($form_ids)) { foreach ($form_ids as $form_id) { $result = GFAPI::delete_form($form_id); if (is_wp_error($result)) { break; } $count++; } } else { $result = GFAPI::delete_form($form_ids); $count++; } if (isset($result) && is_wp_error($result)) { $response = $this->get_error_response($result); $status = $this->get_error_status($result); } else { $status = 200; $response = sprintf(__("Forms deleted successfully: %d", "gravityforms"), $count); } $this->end($status, $response); }
public function delete_forms($form_ids) { $this->log_debug(__METHOD__ . '(): Running.'); $capability = apply_filters('gform_web_api_capability_delete_forms', 'gravityforms_delete_forms'); $this->authorize($capability); $count = 0; if (is_array($form_ids)) { foreach ($form_ids as $form_id) { $result = GFAPI::delete_form($form_id); if (is_wp_error($result)) { break; } $count++; } } else { $result = GFAPI::delete_form($form_ids); $count++; } if (isset($result) && is_wp_error($result)) { $response = $this->get_error_response($result); $status = $this->get_error_status($result); } else { $status = 200; $response = sprintf(__('Forms deleted successfully: %d', 'gravityforms'), $count); } $this->end($status, $response); }