diff --git a/README.md b/README.md index 5874425..a905d15 100644 --- a/README.md +++ b/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. +**Version:** 0.05 + ## Features - **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 - **Multiple Export Formats** - CSV, Pairgoth (JSON), OpenGotha (XML), McMahon (XML) - **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 @@ -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: -- **Create Forms** - Add new registration forms -- **Manage Forms** - View all forms with their shortcodes -- **View Entries** - See all submissions for a form +- **Create Forms** - Add new registration forms with names +- **Manage Forms** - View all forms with their shortcodes and IDs +- **View Entries** - See all submissions for a form in a sortable table +- **Edit Entries** - Modify existing player 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 +- **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 @@ -63,12 +72,23 @@ Players can click the "Search EGD" button on the frontend form to look up their ## Database -The plugin creates two tables: +The plugin creates four tables: -- `wp_go_form_forms` - Stores form definitions -- `wp_go_form_entries` - Stores all player registrations +- `wp_go_form_forms` - Stores form definitions (id, name, created_at) +- `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 @@ -92,22 +112,83 @@ Both tables are automatically removed when the plugin is uninstalled. ### Actions -- `admin_post_go_form_handle_submission` - Form submission handler -- `admin_post_go_form_delete_entry` - Delete entry handler -- `admin_post_go_form_create_form` - Create form handler -- `admin_post_go_form_delete_form` - Delete form handler +**Form Handling:** +- `admin_post_go_form_handle_submission` - Frontend form submission handler +- `admin_post_go_form_update_entry` - Update entry from admin panel + +**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_pairgoth` - Pairgoth export handler -- `admin_post_go_form_export_opengotha` - OpenGotha export handler -- `admin_post_go_form_export_mcmahon` - McMahon export handler +- `admin_post_go_form_export_pairgoth` - Pairgoth JSON export handler +- `admin_post_go_form_export_opengotha` - OpenGotha XML 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 - All forms use WordPress nonces for CSRF protection - Admin actions require `manage_options` capability -- All input is sanitized using WordPress sanitization functions -- Direct file access is blocked +- All input is sanitized using WordPress sanitization functions (`sanitize_text_field`, `sanitize_textarea_field`, `intval`) +- 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 -Nikola Petrov nikola@petrovv.com +Nikola Petrov - nikola@petrovv.com + +## License + +MIT License - See LICENSE file for details.