public static function editForm() { $model = new \Testimonials\Models\FormModel(); if (isset($_GET['id'])) { $form = $model->getItemById($_GET['id']); include ABSPATH . 'wp-content/plugins/wordpress-testimonials/views/edit_form.php'; } }
/** * Create tesitmonial form. Called when using the shortcode */ public static function createItemForm($id) { if (!empty($_GET)) { //This is to be removed and put into the model global $wpdb; foreach ($_GET as $key => $value) { if ($key != 'form-id') { $res = $wpdb->get_results("\n SELECT id FROM wp_testimonials_forms_fields\n WHERE form_id = " . $_GET['form-id'] . "\n AND name = '" . $key . "'\n "); $pivot_id = $res[0]->id; $wpdb->insert($wpdb->prefix . "testimonials_values", array('created' => current_time('mysql'), 'pivot_id' => $pivot_id, 'value' => $value)); } } } $formModel = new \Testimonials\Models\FormModel(); $form = $formModel->getItemById($id); include ABSPATH . 'wp-content/plugins/wordpress-testimonials/partials/testimonial_form.php'; }