=== SGL Events ===
Contributors: sovereigngl
Tags: tournaments, events, esports, woocommerce, game store
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show your Sovereign Gaming League events on your site and sell entries through WooCommerce checkout. Buyers are registered as soon as they pay.

== Description ==

[Sovereign Gaming League (SGL)](https://www.sovereigngl.com) runs tournaments, leagues and ladders for video games, card games, board games, miniatures and sports. This plugin connects your WordPress site to your SGL organization.

* **Show your events** on any page with the SGL Events block or the `[sgl_events]` shortcode (works without WooCommerce).
* **Sell entries through your own checkout.** Choose an event and a price, and the plugin creates the product. Buyers enter their SGL ID (or click *Use my SGL account* to fill it in) and are registered on SGL as soon as the order is paid.
* **Team events too:** a team entry, each player's share, or both. Shares put the player on their team's roster.
* **New to SGL? Buy anyway.** Buyers without an account leave an email; their spot is held and SGL emails them a link to create their account and take it.
* **Always in step:** products go out of stock when an event fills, closes or starts, and back in stock when a spot opens.
* **Automation:** list new SGL events automatically at your default prices, and refund entries automatically when they can't be registered.
* **Refunds** and cancellations withdraw the entry on SGL (before the event starts).
* **Prizes as store credit:** one-use coupons for finishers, sent to the winners on SGL.
* Order emails and the customer's order page show their registration, with a link to the event.

The money goes through your own WooCommerce payment methods. SGL never holds it.

= External service =

This plugin connects to the Sovereign Gaming League service (api.sovereigngl.com and www.sovereigngl.com) to:

* list your organization's events and keep products in or out of stock;
* check the SGL IDs buyers enter on product pages;
* register buyers when an order is paid, and withdraw them when it's refunded or cancelled. It sends the order and line numbers and the SGL player and team IDs entered for each entry. For buyers new to SGL it sends the email they gave for their claim link. It never sends names, addresses or payment details;
* record prize coupon codes so SGL can tell the winners.

SGL can also call your site's `/wp-json/sgl-events/v1/sync` address (signed) to say products need updating. See SGL's [Terms of Service](https://www.sovereigngl.com/terms) and [Privacy Policy](https://www.sovereigngl.com/privacy).

== Installation ==

1. Install and activate the plugin (WooCommerce is needed to sell entries).
2. Go to **WooCommerce → SGL Events** and click **Connect to SGL**. Sign in on SGL and choose your organization (you need to be its owner or an admin).
3. On the **Events** tab, set a price for an event and click **Sell in my store**. Or, on **Settings**, turn on *List events automatically*.
4. Add the **SGL Events** block to a page.

== Frequently Asked Questions ==

= Where do buyers find their SGL ID? =

On their SGL profile, with a Copy button. Or they click *Use my SGL account* on the product page and sign in.

= What happens if an entry can't be registered? =

The order gets a note with the reason, the customer's order shows it, and your organization is told on SGL. With *Refund failed entries* on, the entry is refunded automatically.

= Can I still take entries on SGL itself? =

An event is either sold in your store or takes entry fees on SGL, not both. Teams can register on SGL and pay their entry in your store.

== Screenshots ==

1. The SGL Events page: your events, with prices and stock.
2. An entry's product page, with the SGL ID check and Use my SGL account.
3. The SGL Events block on a page.

== Changelog ==

= 1.2.0 =
* Security and naming: every form and request checks its nonce and the user's permission, and all stored data uses the sgl_events prefix (existing products and orders are updated automatically).

= 1.1.0 =
* Events with several phase 1 sub-events (for example qualifiers on different days) get one product per sub-event, each with its own price; buyers are entered in the sub-event they bought.

= 1.0.0 =
* First release.
