Files
wp-go-form/README.md

114 lines
3.6 KiB
Markdown

# Go Form Plugin
A WordPress plugin for managing Go (Baduk/Weiqi) tournament registrations. Collect player information through frontend forms and export entries to popular tournament management systems.
## Features
- **Frontend Registration Form** with shortcode support
- **EGD Database Integration** - Search and auto-fill player data from the European Go Database
- **Rank Selection** - Dropdown with ranks from 30k to 9p
- **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
## Installation
1. Upload the `go-form-plugin` folder to your `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. A default form is automatically created on activation
## Usage
### Displaying a Form
Use the shortcode to display a registration form on any page or post:
```
[go_form id=1]
```
Replace `1` with your form ID. Find form IDs in the admin settings page.
### Admin Settings
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
- **Delete Entries** - Remove individual registrations
- **Delete Forms** - Remove a form and all its entries (cannot delete default form)
- **Export Data** - Download entries in various tournament formats
### EGD Search
Players can click the "Search EGD" button on the frontend form to look up their information in the European Go Database. This auto-fills:
- First Name
- Last Name
- Country
- Club
- Rank
- EGD Number
- Rating
## Export Formats
| Format | File Extension | Description |
|--------|---------------|-------------|
| CSV | `.csv` | Standard spreadsheet format |
| Pairgoth | `.tour` | JSON format for Pairgoth pairing system |
| OpenGotha | `.xml` | XML format for OpenGotha tournament manager |
| McMahon | `.xml` | XML format for McMahon tournament system |
## Database
The plugin creates two tables:
- `wp_go_form_forms` - Stores form definitions
- `wp_go_form_entries` - Stores all player registrations
Both tables are automatically removed when the plugin is uninstalled.
## Requirements
- WordPress 5.0 or higher
- PHP 7.4 or higher
- MySQL 5.6 or higher
## Fields Collected
| Field | Required | Description |
|-------|----------|-------------|
| First Name | Yes | Player's first name |
| Last Name | Yes | Player's last name |
| Country | Yes | Country code (2-3 letters) |
| Club | Yes | Club name |
| Rank | Yes | Go rank (30k to 9p) |
| Rating | No | EGD rating (auto-calculated from rank if missing) |
| EGD Number | No | European Go Database PIN |
## Hooks
### 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
- `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
## 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
## Author
Nikola Petrov nikola@petrovv.com