Compare commits
10 Commits
ed67849629
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ffaa624f65 | |||
| 6e1bc4ac1b | |||
| ad1a535795 | |||
| 7c6eaa895d | |||
| f5a48a62db | |||
| 529dd442b5 | |||
| 13a4ee0ae7 | |||
| 9ef421eeb5 | |||
| 38a3a2153b | |||
| 851c9d3674 |
119
README.md
119
README.md
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
A WordPress plugin for managing Go (Baduk/Weiqi) tournament registrations. Collect player information through frontend forms and export entries to popular tournament management systems.
|
A WordPress plugin for managing Go (Baduk/Weiqi) tournament registrations. Collect player information through frontend forms and export entries to popular tournament management systems.
|
||||||
|
|
||||||
|
**Version:** 0.05
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **Frontend Registration Form** with shortcode support
|
- **Frontend Registration Form** with shortcode support
|
||||||
@@ -10,7 +12,11 @@ A WordPress plugin for managing Go (Baduk/Weiqi) tournament registrations. Colle
|
|||||||
- **Automatic Rating Calculation** - Auto-computes rating from rank when needed
|
- **Automatic Rating Calculation** - Auto-computes rating from rank when needed
|
||||||
- **Multiple Export Formats** - CSV, Pairgoth (JSON), OpenGotha (XML), McMahon (XML)
|
- **Multiple Export Formats** - CSV, Pairgoth (JSON), OpenGotha (XML), McMahon (XML)
|
||||||
- **Multi-Form Support** - Create and manage multiple registration forms
|
- **Multi-Form Support** - Create and manage multiple registration forms
|
||||||
- **Admin Dashboard** - View, delete, and export entries
|
- **Admin Dashboard** - View, delete, export entries, and manage forms
|
||||||
|
- **Custom Fields** - Add unlimited custom fields (text, email, textarea, select, checkbox) to forms
|
||||||
|
- **Entry Editing** - Edit existing registrations from admin panel
|
||||||
|
- **EGD Data Sync** - Batch update rank and rating from EGD for all entries with EGD numbers
|
||||||
|
- **Responsive Design** - Frontend form with grid layout
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -34,12 +40,15 @@ Replace `1` with your form ID. Find form IDs in the admin settings page.
|
|||||||
|
|
||||||
Navigate to **Go Form** in the WordPress admin menu to:
|
Navigate to **Go Form** in the WordPress admin menu to:
|
||||||
|
|
||||||
- **Create Forms** - Add new registration forms
|
- **Create Forms** - Add new registration forms with names
|
||||||
- **Manage Forms** - View all forms with their shortcodes
|
- **Manage Forms** - View all forms with their shortcodes and IDs
|
||||||
- **View Entries** - See all submissions for a form
|
- **View Entries** - See all submissions for a form in a sortable table
|
||||||
|
- **Edit Entries** - Modify existing player registrations
|
||||||
- **Delete Entries** - Remove individual registrations
|
- **Delete Entries** - Remove individual registrations
|
||||||
- **Delete Forms** - Remove a form and all its entries (cannot delete default form)
|
- **Delete Forms** - Remove a form and all its entries (cascading delete)
|
||||||
- **Export Data** - Download entries in various tournament formats
|
- **Export Data** - Download entries in various tournament formats
|
||||||
|
- **Manage Custom Fields** - Add, edit, and delete custom fields per form
|
||||||
|
- **EGD Data Sync** - Update rank and rating from EGD for all entries with EGD numbers
|
||||||
|
|
||||||
### EGD Search
|
### EGD Search
|
||||||
|
|
||||||
@@ -63,12 +72,23 @@ Players can click the "Search EGD" button on the frontend form to look up their
|
|||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
|
||||||
The plugin creates two tables:
|
The plugin creates four tables:
|
||||||
|
|
||||||
- `wp_go_form_forms` - Stores form definitions
|
- `wp_go_form_forms` - Stores form definitions (id, name, created_at)
|
||||||
- `wp_go_form_entries` - Stores all player registrations
|
- `wp_go_form_entries` - Stores all player registrations with Go-specific fields
|
||||||
|
- `wp_go_form_custom_fields` - Stores custom field definitions per form
|
||||||
|
- `wp_go_form_entry_custom_values` - Stores custom field values for each entry
|
||||||
|
|
||||||
Both tables are automatically removed when the plugin is uninstalled.
|
All tables use foreign keys with CASCADE delete and are automatically removed when the plugin is uninstalled.
|
||||||
|
|
||||||
|
### Rank System
|
||||||
|
|
||||||
|
Ranks are stored as integers (0-47) mapping to:
|
||||||
|
- 0-29: 30k to 1k
|
||||||
|
- 30-38: 1d to 9d
|
||||||
|
- 39-47: 1p to 9p
|
||||||
|
|
||||||
|
Rating auto-calculation: `rating = (rank * 100) - 900`
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@@ -92,22 +112,83 @@ Both tables are automatically removed when the plugin is uninstalled.
|
|||||||
|
|
||||||
### Actions
|
### Actions
|
||||||
|
|
||||||
- `admin_post_go_form_handle_submission` - Form submission handler
|
**Form Handling:**
|
||||||
- `admin_post_go_form_delete_entry` - Delete entry handler
|
- `admin_post_go_form_handle_submission` - Frontend form submission handler
|
||||||
- `admin_post_go_form_create_form` - Create form handler
|
- `admin_post_go_form_update_entry` - Update entry from admin panel
|
||||||
- `admin_post_go_form_delete_form` - Delete form handler
|
|
||||||
|
**Form Management:**
|
||||||
|
- `admin_post_go_form_create_form` - Create new form
|
||||||
|
- `admin_post_go_form_delete_form` - Delete form and all its entries
|
||||||
|
|
||||||
|
**Entry Management:**
|
||||||
|
- `admin_post_go_form_delete_entry` - Delete single entry
|
||||||
|
|
||||||
|
**Custom Fields:**
|
||||||
|
- `admin_post_go_form_create_custom_field` - Create custom field
|
||||||
|
- `admin_post_go_form_update_custom_field` - Update custom field
|
||||||
|
- `admin_post_go_form_delete_custom_field` - Delete custom field
|
||||||
|
|
||||||
|
**EGD Integration:**
|
||||||
|
- `admin_post_go_form_update_egd_data` - Batch update entries from EGD database
|
||||||
|
|
||||||
|
**Export:**
|
||||||
- `admin_post_go_form_export_csv` - CSV export handler
|
- `admin_post_go_form_export_csv` - CSV export handler
|
||||||
- `admin_post_go_form_export_pairgoth` - Pairgoth export handler
|
- `admin_post_go_form_export_pairgoth` - Pairgoth JSON export handler
|
||||||
- `admin_post_go_form_export_opengotha` - OpenGotha export handler
|
- `admin_post_go_form_export_opengotha` - OpenGotha XML export handler
|
||||||
- `admin_post_go_form_export_mcmahon` - McMahon export handler
|
- `admin_post_go_form_export_mcmahon` - McMahon XML export handler
|
||||||
|
|
||||||
|
### Filters
|
||||||
|
|
||||||
|
None currently available.
|
||||||
|
|
||||||
|
## Custom Fields
|
||||||
|
|
||||||
|
Each form can have unlimited custom fields with the following types:
|
||||||
|
|
||||||
|
| Type | Description | Options |
|
||||||
|
|------|-------------|---------|
|
||||||
|
| `text` | Single line text input | - |
|
||||||
|
| `email` | Email address input with validation | - |
|
||||||
|
| `textarea` | Multi-line text input | - |
|
||||||
|
| `select` | Dropdown selection | Comma-separated options |
|
||||||
|
| `checkbox` | Checkbox (yes/no) | - |
|
||||||
|
|
||||||
|
### Custom Field Settings
|
||||||
|
|
||||||
|
- **Public** - Display on frontend form
|
||||||
|
- **Required** - Mandatory field
|
||||||
|
- **Full Width** - Display outside the grid layout
|
||||||
|
|
||||||
## Security
|
## Security
|
||||||
|
|
||||||
- All forms use WordPress nonces for CSRF protection
|
- All forms use WordPress nonces for CSRF protection
|
||||||
- Admin actions require `manage_options` capability
|
- Admin actions require `manage_options` capability
|
||||||
- All input is sanitized using WordPress sanitization functions
|
- All input is sanitized using WordPress sanitization functions (`sanitize_text_field`, `sanitize_textarea_field`, `intval`)
|
||||||
- Direct file access is blocked
|
- Direct file access is blocked with `ABSPATH` check
|
||||||
|
- Database operations use `$wpdb->prepare()` for SQL injection prevention
|
||||||
|
|
||||||
|
## API Integration
|
||||||
|
|
||||||
|
### European Go Database (EGD)
|
||||||
|
|
||||||
|
The plugin integrates with the European Go Database for player data:
|
||||||
|
|
||||||
|
- **Search API**: `https://europeangodatabase.eu/EGD/GetPlayerDataByData.php?lastname=X&name=Y`
|
||||||
|
- **Player Data API**: `https://europeangodatabase.eu/EGD/GetPlayerDataByPIN.php?pin=XXXX`
|
||||||
|
|
||||||
|
Fields retrieved from EGD:
|
||||||
|
- Name, Last Name
|
||||||
|
- Country Code
|
||||||
|
- Club
|
||||||
|
- Grade (rank text)
|
||||||
|
- Grade_n (rank numeric)
|
||||||
|
- Gor (rating)
|
||||||
|
- Pin_Player (EGD PIN)
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
Nikola Petrov nikola@petrovv.com
|
Nikola Petrov - nikola@petrovv.com
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT License - See LICENSE file for details.
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ CREATE TABLE wp_go_form_entries (
|
|||||||
created_at date DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
created_at date DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
FOREIGN KEY (form_id) REFERENCES wp_go_form_forms(id) ON DELETE CASCADE,
|
FOREIGN KEY (form_id) REFERENCES wp_go_form_forms(id) ON DELETE CASCADE,
|
||||||
INDEX (form_id)
|
INDEX (form_id),
|
||||||
|
INDEX (egd_number)
|
||||||
);
|
);
|
||||||
|
|
||||||
-- ========== Custom Fields Tables ==========
|
-- ========== Custom Fields Tables ==========
|
||||||
@@ -29,10 +30,11 @@ CREATE TABLE wp_go_form_custom_fields (
|
|||||||
id int NOT NULL AUTO_INCREMENT,
|
id int NOT NULL AUTO_INCREMENT,
|
||||||
form_id int NOT NULL,
|
form_id int NOT NULL,
|
||||||
field_name varchar(100) NOT NULL,
|
field_name varchar(100) NOT NULL,
|
||||||
field_type enum('select','text','checkbox', 'email') NOT NULL DEFAULT 'text',
|
field_type enum('select','text','checkbox', 'email', 'textarea') NOT NULL DEFAULT 'text',
|
||||||
field_options text,
|
field_options text,
|
||||||
is_public tinyint(1) NOT NULL DEFAULT 0,
|
is_public tinyint(1) NOT NULL DEFAULT 0,
|
||||||
is_required tinyint(1) NOT NULL DEFAULT 0,
|
is_required tinyint(1) NOT NULL DEFAULT 0,
|
||||||
|
is_full_width tinyint(1) NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
FOREIGN KEY (form_id) REFERENCES wp_go_form_forms(id) ON DELETE CASCADE,
|
FOREIGN KEY (form_id) REFERENCES wp_go_form_forms(id) ON DELETE CASCADE,
|
||||||
INDEX (form_id)
|
INDEX (form_id)
|
||||||
|
|||||||
@@ -18,16 +18,16 @@ header('Content-Disposition: attachment; filename="go-form-' . sanitize_title($f
|
|||||||
$output = fopen('php://output', 'w');
|
$output = fopen('php://output', 'w');
|
||||||
|
|
||||||
// Build header row
|
// Build header row
|
||||||
$header = ['ID', 'First Name', 'Last Name', 'Country', 'Club', 'Rank', 'Rating', 'EGD Number', 'Date Added'];
|
$header = ['N', 'First Name', 'Last Name', 'Country', 'Club', 'Rank', 'Rating', 'EGD Number', 'Date Added'];
|
||||||
foreach ($custom_fields as $field) {
|
foreach ($custom_fields as $field) {
|
||||||
$header[] = $field->field_name;
|
$header[] = $field->field_name;
|
||||||
}
|
}
|
||||||
fputcsv($output, $header);
|
fputcsv($output, $header);
|
||||||
|
|
||||||
foreach ($entries as $e) {
|
foreach ($entries as $i => $e) {
|
||||||
global $ranks;
|
global $ranks;
|
||||||
$row = [
|
$row = [
|
||||||
$e->id,
|
$i,
|
||||||
$e->first_name,
|
$e->first_name,
|
||||||
$e->last_name,
|
$e->last_name,
|
||||||
$e->country,
|
$e->country,
|
||||||
|
|||||||
@@ -3,16 +3,16 @@ $mcmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|||||||
<Tournament typeversion="9">
|
<Tournament typeversion="9">
|
||||||
<NumberOfRounds>5</NumberOfRounds>
|
<NumberOfRounds>5</NumberOfRounds>
|
||||||
<CurrentRoundNumber>1</CurrentRoundNumber>
|
<CurrentRoundNumber>1</CurrentRoundNumber>
|
||||||
<TakeCurrentRoundInAccount>false</TakeCurrentRoundInAccount>
|
<TakeCurrentRoundInAccount>true</TakeCurrentRoundInAccount>
|
||||||
<DefaultAsianName>false</DefaultAsianName>
|
<DefaultAsianName>false</DefaultAsianName>
|
||||||
<RatingAllowed>false</RatingAllowed>
|
<RatingAllowed>false</RatingAllowed>
|
||||||
<RatingLowestOneDanRating>2050</RatingLowestOneDanRating>
|
<RatingLowestOneDanRating>2050</RatingLowestOneDanRating>
|
||||||
<RatingDeterminesRank>false</RatingDeterminesRank>
|
<RatingDeterminesRank>false</RatingDeterminesRank>
|
||||||
<RatingDeterminesStartScore>false</RatingDeterminesStartScore>
|
<RatingDeterminesStartScore>false</RatingDeterminesStartScore>
|
||||||
<LowerMacMahonBar>false</LowerMacMahonBar>
|
<LowerMacMahonBar>true</LowerMacMahonBar>
|
||||||
<LowerMacMahonBarLevel>35k</LowerMacMahonBarLevel>
|
<LowerMacMahonBarLevel>10k</LowerMacMahonBarLevel>
|
||||||
<UpperMacMahonBar>false</UpperMacMahonBar>
|
<UpperMacMahonBar>true</UpperMacMahonBar>
|
||||||
<UpperMacMahonBarLevel>9d</UpperMacMahonBarLevel>
|
<UpperMacMahonBarLevel>2k</UpperMacMahonBarLevel>
|
||||||
<UpperMacMahonBarRating>0</UpperMacMahonBarRating>
|
<UpperMacMahonBarRating>0</UpperMacMahonBarRating>
|
||||||
<ByeShouldResultInZeroSOSetc>false</ByeShouldResultInZeroSOSetc>
|
<ByeShouldResultInZeroSOSetc>false</ByeShouldResultInZeroSOSetc>
|
||||||
<HalfScoreGroupsRoundDown>false</HalfScoreGroupsRoundDown>
|
<HalfScoreGroupsRoundDown>false</HalfScoreGroupsRoundDown>
|
||||||
@@ -21,9 +21,9 @@ $mcmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|||||||
<OnlineEgdSupport>true</OnlineEgdSupport>
|
<OnlineEgdSupport>true</OnlineEgdSupport>
|
||||||
<OnlineEgdSupportByPin>false</OnlineEgdSupportByPin>
|
<OnlineEgdSupportByPin>false</OnlineEgdSupportByPin>
|
||||||
<HandicapUsed>true</HandicapUsed>
|
<HandicapUsed>true</HandicapUsed>
|
||||||
<HandicapBelow>true</HandicapBelow>
|
<HandicapBelow>false</HandicapBelow>
|
||||||
<HandicapBelowLevel>1d</HandicapBelowLevel>
|
<HandicapBelowLevel>1d</HandicapBelowLevel>
|
||||||
<HandicapByLevel>false</HandicapByLevel>
|
<HandicapByLevel>true</HandicapByLevel>
|
||||||
<HandicapAdjustment>true</HandicapAdjustment>
|
<HandicapAdjustment>true</HandicapAdjustment>
|
||||||
<HandicapAdjustmentValue>-2</HandicapAdjustmentValue>
|
<HandicapAdjustmentValue>-2</HandicapAdjustmentValue>
|
||||||
<HandicapLimit>true</HandicapLimit>
|
<HandicapLimit>true</HandicapLimit>
|
||||||
@@ -39,9 +39,9 @@ $mcmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|||||||
<PairingsShortNotationForLevel>false</PairingsShortNotationForLevel>
|
<PairingsShortNotationForLevel>false</PairingsShortNotationForLevel>
|
||||||
<PairingsShowScores>false</PairingsShowScores>
|
<PairingsShowScores>false</PairingsShowScores>
|
||||||
<PairingsShowHandicaps>true</PairingsShowHandicaps>
|
<PairingsShowHandicaps>true</PairingsShowHandicaps>
|
||||||
<PairingsFontsize>12</PairingsFontsize>
|
<PairingsFontsize>18</PairingsFontsize>
|
||||||
<PairingsBlackColumnWidth>205</PairingsBlackColumnWidth>
|
<PairingsBlackColumnWidth>283</PairingsBlackColumnWidth>
|
||||||
<PairingsWhiteColumnWidth>205</PairingsWhiteColumnWidth>
|
<PairingsWhiteColumnWidth>301</PairingsWhiteColumnWidth>
|
||||||
<ImportEncoding>UTF-8</ImportEncoding>
|
<ImportEncoding>UTF-8</ImportEncoding>
|
||||||
<ExportColumnDelimiter><![CDATA[f]]></ExportColumnDelimiter>
|
<ExportColumnDelimiter><![CDATA[f]]></ExportColumnDelimiter>
|
||||||
<ExportWalllistShowTournamentTitle>true</ExportWalllistShowTournamentTitle>
|
<ExportWalllistShowTournamentTitle>true</ExportWalllistShowTournamentTitle>
|
||||||
@@ -95,13 +95,13 @@ $mcmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|||||||
<ShowColors>false</ShowColors>
|
<ShowColors>false</ShowColors>
|
||||||
<ShowHandicap>true</ShowHandicap>
|
<ShowHandicap>true</ShowHandicap>
|
||||||
<ShowWarningMissingPairing>true</ShowWarningMissingPairing>
|
<ShowWarningMissingPairing>true</ShowWarningMissingPairing>
|
||||||
<Fontsize>12</Fontsize>
|
<Fontsize>18</Fontsize>
|
||||||
<NameColumnWidth>205</NameColumnWidth>
|
<NameColumnWidth>221</NameColumnWidth>
|
||||||
<ClubColumnWidth>0</ClubColumnWidth>
|
<ClubColumnWidth>0</ClubColumnWidth>
|
||||||
<ClubColumnAlignmentCenter>true</ClubColumnAlignmentCenter>
|
<ClubColumnAlignmentCenter>true</ClubColumnAlignmentCenter>
|
||||||
<WeakSortCriteria>1</WeakSortCriteria>
|
<WeakSortCriteria>1</WeakSortCriteria>
|
||||||
<SortCriterionDescriptor typeversion="2">
|
<SortCriterionDescriptor typeversion="2">
|
||||||
<ShortName>ScoreX</ShortName>
|
<ShortName>Score</ShortName>
|
||||||
</SortCriterionDescriptor>
|
</SortCriterionDescriptor>
|
||||||
<SortCriterionDescriptor typeversion="2">
|
<SortCriterionDescriptor typeversion="2">
|
||||||
<ShortName>SOS</ShortName>
|
<ShortName>SOS</ShortName>
|
||||||
@@ -109,6 +109,9 @@ $mcmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|||||||
<SortCriterionDescriptor typeversion="2">
|
<SortCriterionDescriptor typeversion="2">
|
||||||
<ShortName>SOSOS</ShortName>
|
<ShortName>SOSOS</ShortName>
|
||||||
</SortCriterionDescriptor>
|
</SortCriterionDescriptor>
|
||||||
|
<SortCriterionDescriptor typeversion="2">
|
||||||
|
<ShortName>ScoreX</ShortName>
|
||||||
|
</SortCriterionDescriptor>
|
||||||
</Walllist>
|
</Walllist>
|
||||||
<Country typeversion="1">
|
<Country typeversion="1">
|
||||||
<InternetCode>ac</InternetCode>
|
<InternetCode>ac</InternetCode>
|
||||||
@@ -1989,10 +1992,6 @@ $mcmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|||||||
<Country typeversion="1">
|
<Country typeversion="1">
|
||||||
<InternetCode>si</InternetCode>
|
<InternetCode>si</InternetCode>
|
||||||
<Name>Slovenia</Name>
|
<Name>Slovenia</Name>
|
||||||
<Club typeversion="1">
|
|
||||||
<Name>Ljub</Name>
|
|
||||||
<EGDName>Ljub</EGDName>
|
|
||||||
</Club>
|
|
||||||
</Country>
|
</Country>
|
||||||
<Country typeversion="1">
|
<Country typeversion="1">
|
||||||
<InternetCode>sj</InternetCode>
|
<InternetCode>sj</InternetCode>
|
||||||
@@ -2193,23 +2192,22 @@ $mcmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|||||||
|
|
||||||
$mcmahonlast = '<TournamentRound typeversion="2">
|
$mcmahonlast = '<TournamentRound typeversion="2">
|
||||||
<RoundNumber>1</RoundNumber>
|
<RoundNumber>1</RoundNumber>
|
||||||
<LastUpdated>2026-05-06 22:15:42</LastUpdated>
|
<LastUpdated>2026-05-13 21:30:31</LastUpdated>
|
||||||
</TournamentRound>
|
</TournamentRound>
|
||||||
<TournamentRound typeversion="2">
|
<TournamentRound typeversion="2">
|
||||||
<RoundNumber>2</RoundNumber>
|
<RoundNumber>2</RoundNumber>
|
||||||
<LastUpdated>2026-05-06 22:15:42</LastUpdated>
|
<LastUpdated>2026-05-13 21:30:21</LastUpdated>
|
||||||
</TournamentRound>
|
</TournamentRound>
|
||||||
<TournamentRound typeversion="2">
|
<TournamentRound typeversion="2">
|
||||||
<RoundNumber>3</RoundNumber>
|
<RoundNumber>3</RoundNumber>
|
||||||
<LastUpdated>2026-05-06 22:15:42</LastUpdated>
|
<LastUpdated>2026-05-13 21:30:10</LastUpdated>
|
||||||
</TournamentRound>
|
</TournamentRound>
|
||||||
<TournamentRound typeversion="2">
|
<TournamentRound typeversion="2">
|
||||||
<RoundNumber>4</RoundNumber>
|
<RoundNumber>4</RoundNumber>
|
||||||
<LastUpdated>2026-05-06 22:15:42</LastUpdated>
|
<LastUpdated>2026-05-13 21:29:20</LastUpdated>
|
||||||
</TournamentRound>
|
</TournamentRound>
|
||||||
<TournamentRound typeversion="2">
|
<TournamentRound typeversion="2">
|
||||||
<RoundNumber>5</RoundNumber>
|
<RoundNumber>5</RoundNumber>
|
||||||
<LastUpdated>2026-05-06 22:15:42</LastUpdated>
|
<LastUpdated>2026-05-13 21:29:04</LastUpdated>
|
||||||
</TournamentRound>
|
</TournamentRound>
|
||||||
</Tournament>
|
</Tournament>';
|
||||||
';
|
|
||||||
@@ -34,17 +34,19 @@ function go_form_activate()
|
|||||||
created_at date DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
created_at date DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
FOREIGN KEY (form_id) REFERENCES $forms(id) ON DELETE CASCADE,
|
FOREIGN KEY (form_id) REFERENCES $forms(id) ON DELETE CASCADE,
|
||||||
INDEX (form_id)
|
INDEX (form_id),
|
||||||
|
INDEX (egd_number)
|
||||||
) $charset;");
|
) $charset;");
|
||||||
|
|
||||||
dbDelta("CREATE TABLE $custom_fields (
|
dbDelta("CREATE TABLE $custom_fields (
|
||||||
id int NOT NULL AUTO_INCREMENT,
|
id int NOT NULL AUTO_INCREMENT,
|
||||||
form_id int NOT NULL,
|
form_id int NOT NULL,
|
||||||
field_name varchar(100) NOT NULL,
|
field_name varchar(100) NOT NULL,
|
||||||
field_type enum('select','text','checkbox', 'email') NOT NULL DEFAULT 'text',
|
field_type enum('select','text','checkbox', 'email', 'textarea') NOT NULL DEFAULT 'text',
|
||||||
field_options text,
|
field_options text,
|
||||||
is_public tinyint(1) NOT NULL DEFAULT 0,
|
is_public tinyint(1) NOT NULL DEFAULT 0,
|
||||||
is_required tinyint(1) NOT NULL DEFAULT 0,
|
is_required tinyint(1) NOT NULL DEFAULT 0,
|
||||||
|
is_full_width tinyint(1) NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
FOREIGN KEY (form_id) REFERENCES $forms(id) ON DELETE CASCADE,
|
FOREIGN KEY (form_id) REFERENCES $forms(id) ON DELETE CASCADE,
|
||||||
INDEX (form_id)
|
INDEX (form_id)
|
||||||
@@ -231,6 +233,7 @@ function go_form_handle_submission()
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
add_action('admin_post_go_form_handle_submission', 'go_form_handle_submission');
|
add_action('admin_post_go_form_handle_submission', 'go_form_handle_submission');
|
||||||
|
Pleadd_action('admin_post_nopriv_go_form_handle_submission', 'go_form_handle_submission');
|
||||||
|
|
||||||
// ========== Shortcode ==========
|
// ========== Shortcode ==========
|
||||||
function go_form_shortcode($atts)
|
function go_form_shortcode($atts)
|
||||||
@@ -352,6 +355,7 @@ function go_form_create_custom_field()
|
|||||||
$field_options = isset($_POST['field_options']) ? sanitize_textarea_field($_POST['field_options']) : '';
|
$field_options = isset($_POST['field_options']) ? sanitize_textarea_field($_POST['field_options']) : '';
|
||||||
$is_public = isset($_POST['is_public']) ? 1 : 0;
|
$is_public = isset($_POST['is_public']) ? 1 : 0;
|
||||||
$is_required = isset($_POST['is_required']) ? 1 : 0;
|
$is_required = isset($_POST['is_required']) ? 1 : 0;
|
||||||
|
$is_full_width = isset($_POST['is_full_width']) ? 1 : 0;
|
||||||
|
|
||||||
$wpdb->insert("{$wpdb->prefix}go_form_custom_fields", [
|
$wpdb->insert("{$wpdb->prefix}go_form_custom_fields", [
|
||||||
'form_id' => $form_id,
|
'form_id' => $form_id,
|
||||||
@@ -359,7 +363,8 @@ function go_form_create_custom_field()
|
|||||||
'field_type' => $field_type,
|
'field_type' => $field_type,
|
||||||
'field_options' => $field_options,
|
'field_options' => $field_options,
|
||||||
'is_public' => $is_public,
|
'is_public' => $is_public,
|
||||||
'is_required' => $is_required
|
'is_required' => $is_required,
|
||||||
|
'is_full_width' => $is_full_width
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$redirect_url = add_query_arg(array('page' => 'go-form-settings', 'form_id' => $_POST['form_id'], 'created_field' => 1), admin_url('admin.php'));
|
$redirect_url = add_query_arg(array('page' => 'go-form-settings', 'form_id' => $_POST['form_id'], 'created_field' => 1), admin_url('admin.php'));
|
||||||
@@ -379,13 +384,15 @@ function go_form_update_custom_field()
|
|||||||
$field_options = isset($_POST['field_options']) ? sanitize_textarea_field($_POST['field_options']) : '';
|
$field_options = isset($_POST['field_options']) ? sanitize_textarea_field($_POST['field_options']) : '';
|
||||||
$is_public = isset($_POST['is_public']) ? 1 : 0;
|
$is_public = isset($_POST['is_public']) ? 1 : 0;
|
||||||
$is_required = isset($_POST['is_required']) ? 1 : 0;
|
$is_required = isset($_POST['is_required']) ? 1 : 0;
|
||||||
|
$is_full_width = isset($_POST['is_full_width']) ? 1 : 0;
|
||||||
|
|
||||||
$wpdb->update("{$wpdb->prefix}go_form_custom_fields", [
|
$wpdb->update("{$wpdb->prefix}go_form_custom_fields", [
|
||||||
'field_name' => $field_name,
|
'field_name' => $field_name,
|
||||||
'field_type' => $field_type,
|
'field_type' => $field_type,
|
||||||
'field_options' => $field_options,
|
'field_options' => $field_options,
|
||||||
'is_public' => $is_public,
|
'is_public' => $is_public,
|
||||||
'is_required' => $is_required
|
'is_required' => $is_required,
|
||||||
|
'is_full_width' => $is_full_width
|
||||||
], ['id' => $field_id]);
|
], ['id' => $field_id]);
|
||||||
}
|
}
|
||||||
$redirect_url = add_query_arg(array('page' => 'go-form-settings', 'form_id' => $_POST['form_id'], 'updated_field' => 1), admin_url('admin.php'));
|
$redirect_url = add_query_arg(array('page' => 'go-form-settings', 'form_id' => $_POST['form_id'], 'updated_field' => 1), admin_url('admin.php'));
|
||||||
@@ -397,9 +404,9 @@ add_action('admin_post_go_form_update_custom_field', 'go_form_update_custom_fiel
|
|||||||
function go_form_delete_custom_field()
|
function go_form_delete_custom_field()
|
||||||
{
|
{
|
||||||
go_form_admin_action('delete_custom_field');
|
go_form_admin_action('delete_custom_field');
|
||||||
if (isset($_POST['field_id'])) {
|
if (isset($_POST['value_one'])) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$field_id = intval($_POST['field_id']);
|
$field_id = intval($_POST['value_one']);
|
||||||
$field = go_form_get_custom_field_by_id($field_id);
|
$field = go_form_get_custom_field_by_id($field_id);
|
||||||
$form_id = $field ? $field->form_id : 0;
|
$form_id = $field ? $field->form_id : 0;
|
||||||
$wpdb->delete("{$wpdb->prefix}go_form_custom_fields", ['id' => $field_id]);
|
$wpdb->delete("{$wpdb->prefix}go_form_custom_fields", ['id' => $field_id]);
|
||||||
|
|||||||
@@ -54,6 +54,15 @@
|
|||||||
grid-template-columns: auto auto;
|
grid-template-columns: auto auto;
|
||||||
column-gap: 16px;
|
column-gap: 16px;
|
||||||
}
|
}
|
||||||
|
.go-form-user-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto auto min-content;
|
||||||
|
column-gap: 16px;
|
||||||
|
}
|
||||||
|
.egd-search {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div id="form">
|
<div id="form">
|
||||||
@@ -62,7 +71,8 @@
|
|||||||
<input type="hidden" name="action" value="go_form_handle_submission">
|
<input type="hidden" name="action" value="go_form_handle_submission">
|
||||||
<input type="hidden" name="form_id" value="<?php echo esc_attr($form_id); ?>">
|
<input type="hidden" name="form_id" value="<?php echo esc_attr($form_id); ?>">
|
||||||
<input type="hidden" name="rating" id="rating" value="-1000">
|
<input type="hidden" name="rating" id="rating" value="-1000">
|
||||||
<div class="go-form-grid">
|
|
||||||
|
<div class="go-form-user-grid">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="first_name">First Name*:</label><input type="text" name="first_name" id="first_name" required>
|
<label for="first_name">First Name*:</label><input type="text" name="first_name" id="first_name" required>
|
||||||
@@ -72,10 +82,13 @@
|
|||||||
<label for="last_name">Last Name*:</label><input type="text" name="last_name" id="last_name" required>
|
<label for="last_name">Last Name*:</label><input type="text" name="last_name" id="last_name" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="egd-search">
|
||||||
<button type="button" id="egd-search" class="button">Search EGD</button>
|
<button type="button" id="egd-search" class="button">Search EGD</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="go-form-grid">
|
||||||
<div>
|
<div>
|
||||||
<label for="rank">Rank*:</label>
|
<label for="rank">Rank*:</label>
|
||||||
<select name="rank" id="rank">
|
<select name="rank" id="rank">
|
||||||
@@ -92,7 +105,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="club">Club*:</label><input type="text" name="club" id="club" required>
|
<label for="club">Club:</label><input type="text" name="club" id="club">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@@ -102,7 +115,19 @@
|
|||||||
<?php
|
<?php
|
||||||
// Display custom fields
|
// Display custom fields
|
||||||
$custom_fields = go_form_get_custom_fields($form_id);
|
$custom_fields = go_form_get_custom_fields($form_id);
|
||||||
foreach ($custom_fields as $field):
|
$full_width_fields = [];
|
||||||
|
$grid_fields = [];
|
||||||
|
|
||||||
|
foreach ($custom_fields as $field) {
|
||||||
|
if ($field->is_full_width) {
|
||||||
|
$full_width_fields[] = $field;
|
||||||
|
} else {
|
||||||
|
$grid_fields[] = $field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render grid fields
|
||||||
|
foreach ($grid_fields as $field):
|
||||||
$field_id = 'custom_field_' . $field->id;
|
$field_id = 'custom_field_' . $field->id;
|
||||||
echo '<div' . ($field->field_type === 'checkbox' ? ' style="grid-column: span 2;"' : '') . '>';
|
echo '<div' . ($field->field_type === 'checkbox' ? ' style="grid-column: span 2;"' : '') . '>';
|
||||||
echo '<label for="' . esc_attr($field_id) . '">' . esc_html($field->field_name) . ($field->is_required ? '*' : '') . ':</label>';
|
echo '<label for="' . esc_attr($field_id) . '">' . esc_html($field->field_name) . ($field->is_required ? '*' : '') . ':</label>';
|
||||||
@@ -114,6 +139,9 @@
|
|||||||
case 'email':
|
case 'email':
|
||||||
echo '<input type="email" name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '"' . ($field->is_required ? ' required' : '') . '>';
|
echo '<input type="email" name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '"' . ($field->is_required ? ' required' : '') . '>';
|
||||||
break;
|
break;
|
||||||
|
case 'textarea':
|
||||||
|
echo '<textarea name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '" rows="4" style="width:100%;"' . ($field->is_required ? ' required' : '') . '></textarea>';
|
||||||
|
break;
|
||||||
case 'select':
|
case 'select':
|
||||||
$options = $field->field_options ? explode(',', $field->field_options) : [];
|
$options = $field->field_options ? explode(',', $field->field_options) : [];
|
||||||
echo '<select name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '"' . ($field->is_required ? ' required' : '') . '>';
|
echo '<select name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '"' . ($field->is_required ? ' required' : '') . '>';
|
||||||
@@ -134,6 +162,41 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Render full-width fields outside the grid
|
||||||
|
foreach ($full_width_fields as $field):
|
||||||
|
$field_id = 'custom_field_' . $field->id;
|
||||||
|
echo '<div style="grid-column: 1 / -1; margin-top: 10px;">';
|
||||||
|
echo '<label for="' . esc_attr($field_id) . '">' . esc_html($field->field_name) . ($field->is_required ? '*' : '') . ':</label>';
|
||||||
|
|
||||||
|
switch ($field->field_type) {
|
||||||
|
case 'text':
|
||||||
|
echo '<input type="text" name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '" style="width:100%;"' . ($field->is_required ? ' required' : '') . '>';
|
||||||
|
break;
|
||||||
|
case 'email':
|
||||||
|
echo '<input type="email" name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '" style="width:100%;"' . ($field->is_required ? ' required' : '') . '>';
|
||||||
|
break;
|
||||||
|
case 'textarea':
|
||||||
|
echo '<textarea name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '" rows="4" style="width:100%;"' . ($field->is_required ? ' required' : '') . '></textarea>';
|
||||||
|
break;
|
||||||
|
case 'select':
|
||||||
|
$options = $field->field_options ? explode(',', $field->field_options) : [];
|
||||||
|
echo '<select name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '" style="width:100%;"' . ($field->is_required ? ' required' : '') . '>';
|
||||||
|
echo '<option value="">-- Select --</option>';
|
||||||
|
foreach ($options as $option) {
|
||||||
|
$option = trim($option);
|
||||||
|
echo '<option value="' . esc_attr($option) . '">' . esc_html($option) . '</option>';
|
||||||
|
}
|
||||||
|
echo '</select>';
|
||||||
|
break;
|
||||||
|
case 'checkbox':
|
||||||
|
echo '<input type="checkbox" name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '" value="1"' . ($field->is_required ? ' required' : '') . '>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
echo '</div>';
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
|
|
||||||
<p>* Required fields</p>
|
<p>* Required fields</p>
|
||||||
<input type="submit" name="go_form_submit" value="Submit">
|
<input type="submit" name="go_form_submit" value="Submit">
|
||||||
</form>
|
</form>
|
||||||
@@ -147,10 +210,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$entries = go_form_get_entries($form_id);
|
$entries = go_form_get_entries($form_id);
|
||||||
$entries_count = count($entries);
|
|
||||||
$custom_fields = go_form_get_custom_fields($form_id);
|
$custom_fields = go_form_get_custom_fields($form_id);
|
||||||
?>
|
?>
|
||||||
<h2>Sign-up players: <?= esc_html($entries_count); ?></h2>
|
|
||||||
<?php go_form_render_entries_table($entries, false, $custom_fields, $form_id); ?>
|
<?php go_form_render_entries_table($entries, false, $custom_fields, $form_id); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -164,11 +225,11 @@
|
|||||||
const lastName = document.getElementById('last_name').value.trim();
|
const lastName = document.getElementById('last_name').value.trim();
|
||||||
|
|
||||||
if (firstName.length < 2) {
|
if (firstName.length < 2) {
|
||||||
alert('Please enter at least 2 characters in first or last name');
|
alert('Please enter at least 2 characters in first and last name');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (lastName.length < 2) {
|
if (lastName.length < 2) {
|
||||||
alert('Please enter at least 2 characters in first or last name');
|
alert('Please enter at least 2 characters in first and last name');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ if (isset($_GET['error']) && $_GET['error'] == 'egd_update_failed')
|
|||||||
echo '<div style="margin-bottom:15px; display: flex; flex-wrap: wrap; gap: 10px;">';
|
echo '<div style="margin-bottom:15px; display: flex; flex-wrap: wrap; gap: 10px;">';
|
||||||
|
|
||||||
action_button('go_form_delete_form', 'Delete Form', 'Delete this form and ALL entries?', $selected_form_id);
|
action_button('go_form_delete_form', 'Delete Form', 'Delete this form and ALL entries?', $selected_form_id);
|
||||||
action_button('go_form_export_csv', 'Export to CSV', 'Confrm Export', $selected_form_id);
|
action_button('go_form_export_csv', 'Export to CSV', 'Confirm Export', $selected_form_id);
|
||||||
action_button('go_form_export_pairgoth', 'Export to Pairgoth', 'Confrm 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', 'Confrm 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', 'Confrm Export', $selected_form_id);
|
action_button('go_form_export_mcmahon', 'Export to McMahon', '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);
|
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 '</div>';
|
echo '</div>';
|
||||||
@@ -69,11 +69,13 @@ if (isset($_GET['error']) && $_GET['error'] == 'egd_update_failed')
|
|||||||
echo '<option value="select">Dropdown (Select)</option>';
|
echo '<option value="select">Dropdown (Select)</option>';
|
||||||
echo '<option value="checkbox">Checkbox</option>';
|
echo '<option value="checkbox">Checkbox</option>';
|
||||||
echo '<option value="email">Email</option>';
|
echo '<option value="email">Email</option>';
|
||||||
|
echo '<option value="textarea">Textarea</option>';
|
||||||
echo '</select>';
|
echo '</select>';
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
echo '<tr><th><label for="field_options">Options (for select, comma-separated):</label></th><td><textarea name="field_options" id="field_options" rows="2" style="width:100%;"></textarea><small>e.g., Option 1,Option 2,Option 3</small></td></tr>';
|
echo '<tr><th><label for="field_options">Options (for select, comma-separated):</label></th><td><textarea name="field_options" id="field_options" rows="2" style="width:100%;"></textarea><small>e.g., Option 1,Option 2,Option 3</small></td></tr>';
|
||||||
echo '<tr><th><label for="is_public">Public:</label></th><td><input type="checkbox" name="is_public" id="is_public" value="1" checked> <small>Show on public form</small></td></tr>';
|
echo '<tr><th><label for="is_public">Public:</label></th><td><input type="checkbox" name="is_public" id="is_public" value="1" checked> <small>Show on public form</small></td></tr>';
|
||||||
echo '<tr><th><label for="is_required">Required:</label></th><td><input type="checkbox" name="is_required" id="is_required" value="1"> <small>Required field</small></td></tr>';
|
echo '<tr><th><label for="is_required">Required:</label></th><td><input type="checkbox" name="is_required" id="is_required" value="1"> <small>Required field</small></td></tr>';
|
||||||
|
echo '<tr><th><label for="is_full_width">Full Width:</label></th><td><input type="checkbox" name="is_full_width" id="is_full_width" value="1"> <small>Display on full width (outside grid)</small></td></tr>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
echo '<p class="submit"><input type="submit" class="button button-primary" value="Add Custom Field"></p>';
|
echo '<p class="submit"><input type="submit" class="button button-primary" value="Add Custom Field"></p>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
@@ -82,13 +84,14 @@ if (isset($_GET['error']) && $_GET['error'] == 'egd_update_failed')
|
|||||||
// List existing custom fields
|
// List existing custom fields
|
||||||
if (!empty($custom_fields)) {
|
if (!empty($custom_fields)) {
|
||||||
echo '<table class="wp-list-table widefat striped" style="margin-top:15px;">';
|
echo '<table class="wp-list-table widefat striped" style="margin-top:15px;">';
|
||||||
echo '<thead><tr><th>Field Name</th><th>Type</th><th>Public</th><th>Required</th><th>Actions</th></tr></thead><tbody>';
|
echo '<thead><tr><th>Field Name</th><th>Type</th><th>Public</th><th>Required</th><th>Full Width</th><th>Actions</th></tr></thead><tbody>';
|
||||||
foreach ($custom_fields as $field) {
|
foreach ($custom_fields as $field) {
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td>' . esc_html($field->field_name) . '</td>';
|
echo '<td>' . esc_html($field->field_name) . '</td>';
|
||||||
echo '<td>' . esc_html($field->field_type) . '</td>';
|
echo '<td>' . esc_html($field->field_type) . '</td>';
|
||||||
echo '<td>' . ($field->is_public ? 'Yes' : 'No') . '</td>';
|
echo '<td>' . ($field->is_public ? 'Yes' : 'No') . '</td>';
|
||||||
echo '<td>' . ($field->is_required ? 'Yes' : 'No') . '</td>';
|
echo '<td>' . ($field->is_required ? 'Yes' : 'No') . '</td>';
|
||||||
|
echo '<td>' . ($field->is_full_width ? 'Yes' : 'No') . '</td>';
|
||||||
echo '<td>';
|
echo '<td>';
|
||||||
// Edit button (toggle to show edit form)
|
// Edit button (toggle to show edit form)
|
||||||
echo '<a href="' . add_query_arg(array('page' => 'go-form-settings', 'form_id' => $selected_form_id, 'edit_field' => $field->id), admin_url('admin.php')) . '" class="button button-small">Edit</a> ';
|
echo '<a href="' . add_query_arg(array('page' => 'go-form-settings', 'form_id' => $selected_form_id, 'edit_field' => $field->id), admin_url('admin.php')) . '" class="button button-small">Edit</a> ';
|
||||||
@@ -119,11 +122,13 @@ if (isset($_GET['error']) && $_GET['error'] == 'egd_update_failed')
|
|||||||
echo '<option value="select"' . selected($edit_field->field_type, 'select', false) . '>Dropdown (Select)</option>';
|
echo '<option value="select"' . selected($edit_field->field_type, 'select', false) . '>Dropdown (Select)</option>';
|
||||||
echo '<option value="checkbox"' . selected($edit_field->field_type, 'checkbox', false) . '>Checkbox</option>';
|
echo '<option value="checkbox"' . selected($edit_field->field_type, 'checkbox', false) . '>Checkbox</option>';
|
||||||
echo '<option value="email"' . selected($edit_field->field_type, 'email', false) . '>Email</option>';
|
echo '<option value="email"' . selected($edit_field->field_type, 'email', false) . '>Email</option>';
|
||||||
|
echo '<option value="textarea"' . selected($edit_field->field_type, 'textarea', false) . '>Textarea</option>';
|
||||||
echo '</select>';
|
echo '</select>';
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
echo '<tr><th><label for="field_options">Options (for select, comma-separated):</label></th><td><textarea name="field_options" id="field_options" rows="2" style="width:100%;">' . esc_textarea($edit_field->field_options) . '</textarea><small>e.g., Option 1,Option 2,Option 3</small></td></tr>';
|
echo '<tr><th><label for="field_options">Options (for select, comma-separated):</label></th><td><textarea name="field_options" id="field_options" rows="2" style="width:100%;">' . esc_textarea($edit_field->field_options) . '</textarea><small>e.g., Option 1,Option 2,Option 3</small></td></tr>';
|
||||||
echo '<tr><th><label for="is_public">Public:</label></th><td><input type="checkbox" name="is_public" id="is_public" value="1" ' . checked($edit_field->is_public, 1, false) . '> <small>Show on public form</small></td></tr>';
|
echo '<tr><th><label for="is_public">Public:</label></th><td><input type="checkbox" name="is_public" id="is_public" value="1" ' . checked($edit_field->is_public, 1, false) . '> <small>Show on public form</small></td></tr>';
|
||||||
echo '<tr><th><label for="is_required">Required:</label></th><td><input type="checkbox" name="is_required" id="is_required" value="1" ' . checked($edit_field->is_required, 1, false) . '> <small>Required field</small></td></tr>';
|
echo '<tr><th><label for="is_required">Required:</label></th><td><input type="checkbox" name="is_required" id="is_required" value="1" ' . checked($edit_field->is_required, 1, false) . '> <small>Required field</small></td></tr>';
|
||||||
|
echo '<tr><th><label for="is_full_width">Full Width:</label></th><td><input type="checkbox" name="is_full_width" id="is_full_width" value="1" ' . checked($edit_field->is_full_width, 1, false) . '> <small>Display on full width (outside grid)</small></td></tr>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
echo '<p class="submit"><input type="submit" class="button button-primary" value="Update Custom Field"> <a href="' . add_query_arg(array('page' => 'go-form-settings', 'form_id' => $selected_form_id), admin_url('admin.php')) . '" class="button">Cancel</a></p>';
|
echo '<p class="submit"><input type="submit" class="button button-primary" value="Update Custom Field"> <a href="' . add_query_arg(array('page' => 'go-form-settings', 'form_id' => $selected_form_id), admin_url('admin.php')) . '" class="button">Cancel</a></p>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
@@ -175,6 +180,9 @@ if (isset($_GET['error']) && $_GET['error'] == 'egd_update_failed')
|
|||||||
case 'email':
|
case 'email':
|
||||||
echo '<input type="email" name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '" value="' . esc_attr($value) . '"' . ($field->is_required ? ' required' : '') . '>';
|
echo '<input type="email" name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '" value="' . esc_attr($value) . '"' . ($field->is_required ? ' required' : '') . '>';
|
||||||
break;
|
break;
|
||||||
|
case 'textarea':
|
||||||
|
echo '<textarea name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '" rows="4" style="width:100%;"' . ($field->is_required ? ' required' : '') . '>' . esc_textarea($value) . '</textarea>';
|
||||||
|
break;
|
||||||
case 'select':
|
case 'select':
|
||||||
$options = $field->field_options ? explode(',', $field->field_options) : [];
|
$options = $field->field_options ? explode(',', $field->field_options) : [];
|
||||||
echo '<select name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '"' . ($field->is_required ? ' required' : '') . '>';
|
echo '<select name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '"' . ($field->is_required ? ' required' : '') . '>';
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<table class="wp-list-table widefat striped">
|
<table class="wp-list-table widefat striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>N</th>
|
||||||
<th>First Name</th>
|
<th>First Name</th>
|
||||||
<th>Last Name</th>
|
<th>Last Name</th>
|
||||||
|
<th>Rank</th>
|
||||||
<th>Country</th>
|
<th>Country</th>
|
||||||
<th>Club</th>
|
<th>Club</th>
|
||||||
<th>Rank</th>
|
|
||||||
<th>EGD Number</th>
|
<th>EGD Number</th>
|
||||||
<th>Date Added</th>
|
<th>Date Added</th>
|
||||||
<?php
|
<?php
|
||||||
@@ -24,15 +25,16 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<?php foreach ($entries as $e): ?>
|
<?php foreach ($entries as $i => $e): ?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
<td> <?= $i + 1 ?> </td>
|
||||||
<td> <?= esc_html($e->first_name) ?> </td>
|
<td> <?= esc_html($e->first_name) ?> </td>
|
||||||
<td> <?= esc_html($e->last_name) ?> </td>
|
<td> <?= esc_html($e->last_name) ?> </td>
|
||||||
|
<td> <?= esc_html($ranks[$e->rank]) ?> </td>
|
||||||
<td> <?= esc_html($e->country) ?> </td>
|
<td> <?= esc_html($e->country) ?> </td>
|
||||||
<td> <?= esc_html($e->club) ?> </td>
|
<td> <?= esc_html($e->club) ?> </td>
|
||||||
<td> <?= esc_html($ranks[$e->rank]) ?> </td>
|
<td><a href="https://europeangodatabase.eu/EGD/Player_Card.php?&key=<?= esc_html($e->egd_number) ?>"><?= esc_html($e->egd_number) ?> </a> </td>
|
||||||
<td> <?= esc_html($e->egd_number) ?> </td>
|
|
||||||
<td> <?= esc_html($e->created_at) ?> </td>
|
<td> <?= esc_html($e->created_at) ?> </td>
|
||||||
<?php
|
<?php
|
||||||
// Display custom field values
|
// Display custom field values
|
||||||
|
|||||||
2
main.php
2
main.php
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* Plugin Name: Go Form Plugin
|
* Plugin Name: Go Form Plugin
|
||||||
* Description: Form plugin for Go players
|
* Description: Form plugin for Go players
|
||||||
* Version: 0.05
|
* Version: 0.06
|
||||||
* Author: Nikola Petrov
|
* Author: Nikola Petrov
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
sudo rm -rf html/wp-content/plugins/go-form-plugin
|
cd ..
|
||||||
sudo cp -r go-form-plugin html/wp-content/plugins/
|
sudo rm -rf scripts/html/wp-content/plugins/go-form-plugin
|
||||||
|
sudo mkdir scripts/html/wp-content/plugins/go-form-plugin
|
||||||
|
sudo cp main.php scripts/html/wp-content/plugins/go-form-plugin/
|
||||||
|
sudo cp -r go-form-plugin scripts/html/wp-content/plugins/go-form-plugin/go-form-plugin/
|
||||||
Reference in New Issue
Block a user