Update js

This commit is contained in:
2026-05-05 23:32:15 +02:00
parent 74eed6bac0
commit bafd54b295
2 changed files with 20 additions and 26 deletions

View File

@@ -2,7 +2,7 @@
/**
* Plugin Name: Go Form Plugin
* Description: Form plugin for Go players
* Version: 0.01
* Version: 0.02
* Author: Nikola Petrov
*/
@@ -145,9 +145,6 @@ function go_form_handle_submission() {
if ($data['rank'] < 0 || $data['rank'] > 47) {
wp_redirect($_SERVER['HTTP_REFERER'] . '?form_error=rank#form'); exit;
}
if (!empty($data['email']) && !is_email($data['email'])) {
wp_redirect($_SERVER['HTTP_REFERER'] . '?form_error=email#form'); exit;
}
$wpdb->insert("{$wpdb->prefix}go_form_entries", $data);
wp_redirect($_SERVER['HTTP_REFERER'] . '?form_success=1#form');
@@ -164,7 +161,7 @@ function go_form_shortcode($atts) {
if (isset($_GET['form_success']) && $_GET['form_success'] == 1)
$msg = '<div>Entry added successfully!</div>';
elseif (isset($_GET['form_error'])) {
$errors = ['1' => 'Please fill in all required fields.', 'rank' => 'Rank must be 0-47.', 'email' => 'Please enter a valid email.'];
$errors = ['1' => 'Please fill in all required fields.', 'rank' => 'Select valid rank'];
$msg = '<div>'.esc_html($errors[$_GET['form_error']] ?? $errors['1']).'</div>';
}