From ad1ed7e45aca5845df5e7995b2a99d23834dccea Mon Sep 17 00:00:00 2001 From: Nikola Petrov Date: Sun, 2 Aug 2026 17:50:30 +0200 Subject: [PATCH] Fix MacMahon output and rename --- .../{mcmahon-help.php => macmahon-help.php} | 4 +- .../export/{mcmahon.php => macmahon.php} | 42 +++++++++++++++++-- go-form-plugin/go-form-plugin.php | 8 ++-- go-form-plugin/templates/settings-page.php | 2 +- 4 files changed, 45 insertions(+), 11 deletions(-) rename go-form-plugin/export/{mcmahon-help.php => macmahon-help.php} (98%) rename go-form-plugin/export/{mcmahon.php => macmahon.php} (54%) diff --git a/go-form-plugin/export/mcmahon-help.php b/go-form-plugin/export/macmahon-help.php similarity index 98% rename from go-form-plugin/export/mcmahon-help.php rename to go-form-plugin/export/macmahon-help.php index 2306dac..717c6a3 100644 --- a/go-form-plugin/export/mcmahon-help.php +++ b/go-form-plugin/export/macmahon-help.php @@ -1,5 +1,5 @@ +$macmahonfirst = ' 5 1 @@ -114,7 +114,7 @@ $mcmahonfirst = ' '; -$mcmahonlast = ' +$macmahonlast = ' 1 2026-05-13 21:30:31 diff --git a/go-form-plugin/export/mcmahon.php b/go-form-plugin/export/macmahon.php similarity index 54% rename from go-form-plugin/export/mcmahon.php rename to go-form-plugin/export/macmahon.php index 5ba9873..f6ba049 100644 --- a/go-form-plugin/export/mcmahon.php +++ b/go-form-plugin/export/macmahon.php @@ -1,6 +1,6 @@ country)); + $club = trim($e->club); + if ($country_code === '' || $club === '') { + continue; + } + if (!isset($clubs_by_country[$country_code])) { + $clubs_by_country[$country_code] = []; + } + if (!in_array($club, $clubs_by_country[$country_code], true)) { + $clubs_by_country[$country_code][] = $club; + } +} + +foreach ($countries as $code => $name) { + $out = ' + ' . esc_html(strtolower($code)) . ' + ' . esc_html($name) . ''; + if (!empty($clubs_by_country[$code])) { + foreach ($clubs_by_country[$code] as $club) { + $out .= ' + + ' . esc_html($club) . ' + ' . esc_html($club) . ' + '; + } + } + $out .= ' + '; + fwrite($output, $out); +} foreach ($entries as $i => $e) { $rank = $ranks[$e->rank]; @@ -44,6 +78,6 @@ foreach ($entries as $i => $e) { fwrite($output, $out); } -fwrite($output, $mcmahonlast); +fwrite($output, $macmahonlast); fclose($output); \ No newline at end of file diff --git a/go-form-plugin/go-form-plugin.php b/go-form-plugin/go-form-plugin.php index 0a57f5b..4dedcbf 100644 --- a/go-form-plugin/go-form-plugin.php +++ b/go-form-plugin/go-form-plugin.php @@ -378,13 +378,13 @@ function go_form_export_opengotha() } add_action('admin_post_go_form_export_opengotha', 'go_form_export_opengotha'); -function go_form_export_mcmahon() +function go_form_export_macmahon() { - global $ranks; - include_once 'export/mcmahon.php'; + global $ranks, $countries; + include_once 'export/macmahon.php'; exit; } -add_action('admin_post_go_form_export_mcmahon', 'go_form_export_mcmahon'); +add_action('admin_post_go_form_export_macmahon', 'go_form_export_macmahon'); // ========== Custom Field Admin Actions ========== function go_form_create_custom_field() diff --git a/go-form-plugin/templates/settings-page.php b/go-form-plugin/templates/settings-page.php index 5ff9373..4d55bcb 100644 --- a/go-form-plugin/templates/settings-page.php +++ b/go-form-plugin/templates/settings-page.php @@ -61,7 +61,7 @@ if (isset($_GET['error']) && $_GET['error'] == 'egd_update_failed') action_button('go_form_export_csv', 'Export to CSV', 'Confirm Export', $selected_form_id); action_button('go_form_export_pairgoth', 'Export to Pairgoth', 'Confirm Export', $selected_form_id); action_button('go_form_export_opengotha', 'Export to Opengoth', 'Confirm Export', $selected_form_id); - action_button('go_form_export_mcmahon', 'Export to McMahon', 'Confirm Export', $selected_form_id); + action_button('go_form_export_macmahon', 'Export to MacMahon', 'Confirm Export', $selected_form_id); action_button('go_form_update_egd_data', 'Update EGD Data', 'Update rank and rating from EGD for all entries with EGD numbers?', $selected_form_id); echo '';