move to template

This commit is contained in:
2026-05-05 00:35:48 +02:00
parent 5902050221
commit 4b26bdc223
2 changed files with 23 additions and 21 deletions

View File

@@ -11,6 +11,7 @@ if (!defined('ABSPATH')) exit;
// ========== Database ==========
function go_form_activate() {
global $wpdb;
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
$charset = $wpdb->get_charset_collate();
$forms = $wpdb->prefix . 'go_form_forms';
$entries = $wpdb->prefix . 'go_form_entries';
@@ -138,27 +139,7 @@ function go_form_shortcode($atts) {
ob_start();
echo $msg;
echo '<div class="go-form-container" id="form">
<h2>Add New Player</h2>
<form method="post" action="'.admin_url('admin-post.php').'">
'.wp_nonce_field('go_form_action', 'go_form_nonce', true, false).'
<input type="hidden" name="action" value="go_form_submit">
<input type="hidden" name="form_id" value="'.esc_attr($form_id).'">
<table class="go-form-table">
<tr><td><label for="first_name">First Name*:</label></td><td><input type="text" name="first_name" id="first_name" required></td></tr>
<tr><td><label for="last_name">Last Name*:</label></td><td><input type="text" name="last_name" id="last_name" required></td></tr>
<tr><td><label for="country">Country:</label></td><td><input type="text" name="country" id="country"></td></tr>
<tr><td><label for="club">Club:</label></td><td><input type="text" name="club" id="club"></td></tr>
<tr><td><label for="rank">Rank (0-40):</label></td><td><input type="number" name="rank" id="rank" min="0" max="40" value="0"></td></tr>
<tr><td><label for="email">Email:</label></td><td><input type="email" name="email" id="email"></td></tr>
<tr><td><label for="egd_number">EGD Number:</label></td><td><input type="text" name="egd_number" id="egd_number"></td></tr>
</table>
<p>* Required fields</p>
<input type="submit" name="go_form_submit" value="Submit" class="go-form-submit">
</form>
<h2>Players</h2>';
go_form_render_entries_table(go_form_get_entries($form_id));
echo '</div>';
include plugin_dir_path(__FILE__) . 'templates/form-shortcode.php';
return ob_get_clean();
}
add_shortcode('go_form', 'go_form_shortcode');