Start work on custom fields
This commit is contained in:
51
go-form-plugin/database-schema.sql
Normal file
51
go-form-plugin/database-schema.sql
Normal file
@@ -0,0 +1,51 @@
|
||||
-- ========== Original Plugin Tables ==========
|
||||
|
||||
CREATE TABLE wp_go_form_forms (
|
||||
id int NOT NULL AUTO_INCREMENT,
|
||||
name varchar(255) NOT NULL,
|
||||
created_at datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE wp_go_form_entries (
|
||||
id int NOT NULL AUTO_INCREMENT,
|
||||
form_id int DEFAULT 1,
|
||||
first_name varchar(100) NOT NULL,
|
||||
last_name varchar(100) NOT NULL,
|
||||
country varchar(100) DEFAULT NULL,
|
||||
club varchar(100) DEFAULT NULL,
|
||||
rank tinyint(2) DEFAULT 0,
|
||||
rating smallint(5) DEFAULT 0,
|
||||
egd_number varchar(20) DEFAULT NULL,
|
||||
created_at date DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (form_id) REFERENCES wp_go_form_forms(id) ON DELETE CASCADE,
|
||||
INDEX (form_id)
|
||||
);
|
||||
|
||||
-- ========== Custom Fields Tables ==========
|
||||
|
||||
CREATE TABLE wp_go_form_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_options text,
|
||||
is_public tinyint(1) NOT NULL DEFAULT 0,
|
||||
is_required tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (form_id) REFERENCES wp_go_form_forms(id) ON DELETE CASCADE,
|
||||
INDEX (form_id)
|
||||
);
|
||||
|
||||
CREATE TABLE wp_go_form_entry_custom_values (
|
||||
id int NOT NULL AUTO_INCREMENT,
|
||||
entry_id int NOT NULL,
|
||||
field_id int NOT NULL,
|
||||
value text,
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (entry_id) REFERENCES wp_go_form_entries(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (field_id) REFERENCES wp_go_form_custom_fields(id) ON DELETE CASCADE,
|
||||
INDEX (entry_id),
|
||||
INDEX (field_id)
|
||||
);
|
||||
@@ -248,7 +248,7 @@ function action_button($action, $name, $confirm_massage, $value_one)
|
||||
{
|
||||
echo '
|
||||
<form method="post" action="' . admin_url('admin-post.php') . '">
|
||||
' . wp_nonce_field($action . '_action', $action . '_nonce', true, false) . '
|
||||
' . wp_nonce_field("{$action}_action", "{$action}_nonce", true, false) . '
|
||||
<input type="hidden" name="action" value="' . $action . '">
|
||||
<input type="hidden" name="value_one" value="' . $value_one . '">
|
||||
<input type="submit" value="' . $name . '" class="button" onclick="return confirm(\'' . $confirm_massage . '\')">
|
||||
|
||||
Reference in New Issue
Block a user