Small fixes

This commit is contained in:
2026-05-06 15:04:53 +02:00
parent 82ac843c03
commit 25deca4779
3 changed files with 9 additions and 9 deletions

View File

@@ -74,7 +74,7 @@ $ranks = [
function go_form_get_forms() function go_form_get_forms()
{ {
global $wpdb; global $wpdb;
return $wpdb->get_results("SELECT * FROM {$wpdb->prefix}go_form_forms ORDER BY name ASC"); return $wpdb->get_results("SELECT * FROM {$wpdb->prefix}go_form_forms ORDER BY created_at DESC");
} }
function go_form_get_entries($form_id) function go_form_get_entries($form_id)
@@ -200,9 +200,6 @@ function go_form_settings_page()
wp_die('No access.'); wp_die('No access.');
$forms = go_form_get_forms(); $forms = go_form_get_forms();
$entries_by_form = [];
foreach ($forms as $f)
$entries_by_form[$f->id] = go_form_get_entries($f->id);
if (isset($_GET['deleted'])) if (isset($_GET['deleted']))
echo '<div class="notice notice-success"><p>Deleted!</p></div>'; echo '<div class="notice notice-success"><p>Deleted!</p></div>';
@@ -228,7 +225,6 @@ function go_form_settings_page()
} }
foreach ($forms as $f) { foreach ($forms as $f) {
$entries = $entries_by_form[$f->id] ?? [];
echo '<div style="margin-bottom:20px"> echo '<div style="margin-bottom:20px">
<h3>' . esc_html($f->name) . ' <span style="color:#888">(ID: ' . esc_html($f->id) . ')</span></h3> <h3>' . esc_html($f->name) . ' <span style="color:#888">(ID: ' . esc_html($f->id) . ')</span></h3>
<p><small>Shortcode: <code>[go_form id=' . esc_html($f->id) . ']</code></small></p> <p><small>Shortcode: <code>[go_form id=' . esc_html($f->id) . ']</code></small></p>
@@ -240,7 +236,7 @@ function go_form_settings_page()
<input type="submit" value="Delete Form" class="button delete" onclick="return confirm(\'Delete this form and ALL entries?\')"> <input type="submit" value="Delete Form" class="button delete" onclick="return confirm(\'Delete this form and ALL entries?\')">
</form>'; </form>';
go_form_render_entries_table($entries, true); go_form_render_entries_table(go_form_get_entries($f->id), true);
echo '</div>'; echo '</div>';
} }
echo '</div>'; echo '</div>';

View File

@@ -119,8 +119,12 @@
<div id="egd-results-content"></div> <div id="egd-results-content"></div>
</div> </div>
</div> </div>
<h2>Players</h2> <?php
<?php go_form_render_entries_table(go_form_get_entries($form_id)); ?> $entries = go_form_get_entries($form_id);
$entries_count = count($entries);
?>
<h2>Sign-up players: <?= esc_html($entries_count); ?></h2>
<?php go_form_render_entries_table($entries); ?>
</div> </div>
<script> <script>

View File

@@ -1,4 +1,4 @@
<table class="wp-list-table widefat fixed striped"> <table class="wp-list-table widefat striped">
<thead> <thead>
<tr> <tr>
<th>First Name</th> <th>First Name</th>