diff --git a/go-form-plugin/database-schema.sql b/go-form-plugin/database-schema.sql index 21dab0c..54a9f99 100644 --- a/go-form-plugin/database-schema.sql +++ b/go-form-plugin/database-schema.sql @@ -15,6 +15,8 @@ CREATE TABLE wp_go_form_entries ( last_name varchar(100) NOT NULL, country varchar(100) DEFAULT NULL, club varchar(100) DEFAULT NULL, + display_country varchar(150) DEFAULT NULL, + display_club varchar(100) DEFAULT NULL, rank tinyint(2) DEFAULT 0, rating smallint(5) DEFAULT 0, egd_number varchar(20) DEFAULT NULL, diff --git a/go-form-plugin/go-form-plugin.php b/go-form-plugin/go-form-plugin.php index 708dc07..ff49c63 100644 --- a/go-form-plugin/go-form-plugin.php +++ b/go-form-plugin/go-form-plugin.php @@ -5,6 +5,7 @@ if (!defined('ABSPATH')) // Load helpers require_once plugin_dir_path(__FILE__) . 'helpers.php'; +require_once plugin_dir_path(__FILE__) . 'countries.php'; // ========== Database =========== function go_form_activate() @@ -32,6 +33,8 @@ function go_form_activate() last_name varchar(100) NOT NULL, country varchar(100) DEFAULT NULL, club varchar(100) DEFAULT NULL, + display_country varchar(150) DEFAULT NULL, + display_club varchar(100) DEFAULT NULL, rank tinyint(2) DEFAULT 0, rating smallint(5) DEFAULT 0, egd_number varchar(20) DEFAULT NULL, @@ -183,6 +186,8 @@ function go_form_handle_submission() 'last_name' => sanitize_text_field($_POST['last_name']), 'country' => sanitize_text_field($_POST['country'] ?? ''), 'club' => sanitize_text_field($_POST['club'] ?? ''), + 'display_country' => sanitize_text_field($_POST['display_country'] ?? ''), + 'display_club' => sanitize_text_field($_POST['display_club'] ?? ''), 'rank' => $rank, 'rating' => $rating, 'egd_number' => sanitize_text_field($_POST['egd_number'] ?? ''), @@ -251,7 +256,7 @@ add_action('admin_post_nopriv_go_form_handle_submission', 'go_form_handle_submis // ========== Shortcode ========== function go_form_shortcode($atts) { - global $ranks; + global $ranks, $countries; $form_id = intval($atts['id']); $form = go_form_get_form_by_id($form_id); @@ -542,6 +547,8 @@ function go_form_update_entry() 'last_name' => sanitize_text_field($_POST['last_name']), 'country' => sanitize_text_field($_POST['country'] ?? ''), 'club' => sanitize_text_field($_POST['club'] ?? ''), + 'display_country' => sanitize_text_field($_POST['display_country'] ?? ''), + 'display_club' => sanitize_text_field($_POST['display_club'] ?? ''), 'rank' => $rank, 'rating' => $rating, 'egd_number' => sanitize_text_field($_POST['egd_number'] ?? ''), diff --git a/go-form-plugin/templates/form-shortcode.php b/go-form-plugin/templates/form-shortcode.php index 5f3692e..5a3c7c6 100644 --- a/go-form-plugin/templates/form-shortcode.php +++ b/go-form-plugin/templates/form-shortcode.php @@ -71,7 +71,9 @@ - + + +
@@ -105,11 +107,11 @@
- +
- +
; function fetchPlayers() { const firstName = document.getElementById('first_name').value.trim(); @@ -269,6 +272,8 @@ document.getElementById('last_name').value = player.Last_Name || player.Real_Last_Name || ''; document.getElementById('country').value = player.Country_Code || ''; document.getElementById('club').value = player.Club || ''; + document.getElementById('display_country').value = countryMap[player.Country_Code] || player.Country_Code || ''; + document.getElementById('display_club').value = player.Club || ''; document.getElementById('rank').value = player.Grade_n || 0; document.getElementById('egd_number').value = player.Pin_Player || ''; document.getElementById('rating').value = player.Gor || 0; diff --git a/go-form-plugin/templates/settings-page.php b/go-form-plugin/templates/settings-page.php index bfa39b5..6e9be9f 100644 --- a/go-form-plugin/templates/settings-page.php +++ b/go-form-plugin/templates/settings-page.php @@ -174,6 +174,8 @@ if (isset($_GET['error']) && $_GET['error'] == 'egd_update_failed') echo ''; echo ''; echo ''; + echo ''; + echo ''; echo ''; echo '