add big filed
This commit is contained in:
@@ -34,17 +34,19 @@ function go_form_activate()
|
||||
created_at date DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (form_id) REFERENCES $forms(id) ON DELETE CASCADE,
|
||||
INDEX (form_id)
|
||||
INDEX (form_id),
|
||||
INDEX (egd_number)
|
||||
) $charset;");
|
||||
|
||||
dbDelta("CREATE TABLE $custom_fields (
|
||||
id int NOT NULL AUTO_INCREMENT,
|
||||
form_id int NOT NULL,
|
||||
field_name varchar(100) NOT NULL,
|
||||
field_type enum('select','text','checkbox', 'email') NOT NULL DEFAULT 'text',
|
||||
field_type enum('select','text','checkbox', 'email', 'textarea') NOT NULL DEFAULT 'text',
|
||||
field_options text,
|
||||
is_public tinyint(1) NOT NULL DEFAULT 0,
|
||||
is_required tinyint(1) NOT NULL DEFAULT 0,
|
||||
is_full_width tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (form_id) REFERENCES $forms(id) ON DELETE CASCADE,
|
||||
INDEX (form_id)
|
||||
@@ -352,6 +354,7 @@ function go_form_create_custom_field()
|
||||
$field_options = isset($_POST['field_options']) ? sanitize_textarea_field($_POST['field_options']) : '';
|
||||
$is_public = isset($_POST['is_public']) ? 1 : 0;
|
||||
$is_required = isset($_POST['is_required']) ? 1 : 0;
|
||||
$is_full_width = isset($_POST['is_full_width']) ? 1 : 0;
|
||||
|
||||
$wpdb->insert("{$wpdb->prefix}go_form_custom_fields", [
|
||||
'form_id' => $form_id,
|
||||
@@ -359,7 +362,8 @@ function go_form_create_custom_field()
|
||||
'field_type' => $field_type,
|
||||
'field_options' => $field_options,
|
||||
'is_public' => $is_public,
|
||||
'is_required' => $is_required
|
||||
'is_required' => $is_required,
|
||||
'is_full_width' => $is_full_width
|
||||
]);
|
||||
}
|
||||
$redirect_url = add_query_arg(array('page' => 'go-form-settings', 'form_id' => $_POST['form_id'], 'created_field' => 1), admin_url('admin.php'));
|
||||
@@ -379,13 +383,15 @@ function go_form_update_custom_field()
|
||||
$field_options = isset($_POST['field_options']) ? sanitize_textarea_field($_POST['field_options']) : '';
|
||||
$is_public = isset($_POST['is_public']) ? 1 : 0;
|
||||
$is_required = isset($_POST['is_required']) ? 1 : 0;
|
||||
$is_full_width = isset($_POST['is_full_width']) ? 1 : 0;
|
||||
|
||||
$wpdb->update("{$wpdb->prefix}go_form_custom_fields", [
|
||||
'field_name' => $field_name,
|
||||
'field_type' => $field_type,
|
||||
'field_options' => $field_options,
|
||||
'is_public' => $is_public,
|
||||
'is_required' => $is_required
|
||||
'is_required' => $is_required,
|
||||
'is_full_width' => $is_full_width
|
||||
], ['id' => $field_id]);
|
||||
}
|
||||
$redirect_url = add_query_arg(array('page' => 'go-form-settings', 'form_id' => $_POST['form_id'], 'updated_field' => 1), admin_url('admin.php'));
|
||||
@@ -397,9 +403,9 @@ add_action('admin_post_go_form_update_custom_field', 'go_form_update_custom_fiel
|
||||
function go_form_delete_custom_field()
|
||||
{
|
||||
go_form_admin_action('delete_custom_field');
|
||||
if (isset($_POST['field_id'])) {
|
||||
if (isset($_POST['value_one'])) {
|
||||
global $wpdb;
|
||||
$field_id = intval($_POST['field_id']);
|
||||
$field_id = intval($_POST['value_one']);
|
||||
$field = go_form_get_custom_field_by_id($field_id);
|
||||
$form_id = $field ? $field->form_id : 0;
|
||||
$wpdb->delete("{$wpdb->prefix}go_form_custom_fields", ['id' => $field_id]);
|
||||
|
||||
Reference in New Issue
Block a user