Creating a Tournament-style Bracket System
Tom Harrigan
Alley Interactive
Who are you?

How to Solve a Complex Problem
Start with whiskey

Installs plugin. Uses 1 feature

March Madness

March Madness

Bracket Essentials: Match-ups
Pairing up items and allowing users to vote.
Demo - Super Heroes

( modals, voting, rounds )
Applications of a Bracket
- E-commerce
- Classroom
- Content
What's needed in a bracket?
- Match-ups
- Things to match up
- Voting
- Sharing
The building blocks are...
- Match-ups – Polls ( polldaddy )
- Things to match up – custom fields ( Fieldmanager)
- Voting – Part of polls ( polldaddy )
- Sharing – ( Sharedaddy/ Jetpack sharing module )
Polldaddy has an API

Create Poll

Vote

Get Results

API Shortfalls

Polldaddy API only allows a single polls to be created at a time
Determining rounds
total number of items = 2^x
Where X = total rounds
Bracket of 32 items:
32 = 2^X
X = 4
So:
X = log2( total number of items )
$total_rounds = log( $total_number_items, 2 );
Creating matchups
Let’s take a look at the admin panel

Seed spacing

Seeds - Statically

Seeds - Statically

Procession of Rounds
Calculate winners of previous rounds.
Match up the round winners.
Create new polls.
Quadrants, Semi finals, Finals
wp_list_filter

wp_list_pluck

Voting

Modals

Modal code

SimpleModal

Sharedaddy

Safety Mechanisms
vip_safe_wp_remote_get()
Disabling drag/drop ordering once Round 1 starts
Only allow next round to be chosen
vip_safe_wp_remote_get

Future Considerations
Displaying tightest match-ups
Handling a bye for rounds that are not a power of 2
Possibly a plugin?
Custom Fields

Beware of repeating fields

Core Fields API
- Check it out on Slack #core-fields
- Check it out on Github
[Insert Questions Here]
