The Swedish Grappling League (SGL) is Sweden’s largest tournament for submission wrestling practitioners throughout the country. Although grappling (submission wrestling) as a sport has not existed for many years in Sweden, it has already attracted hundreds of clubs and thousands of practitioners. Each year, a number of competitions are organised within the six regions into which the country is divided, and the champions of the season are finally decided in a national final. Our task was to create a flexible web solution for registering competitions and managing entries, match lists, match results, rankings, etc.
Why Wordpress?
What we immediately realised was that there was no good ready-made sports event management system(?) to use. Creating our own customised solution was therefore inevitable. However, we wanted to avoid reinventing the wheel for the most basic building blocks such as database layers, template frameworks, etc. With an open CMS like Wordpress, you also get a well-documented API and access to millions of pre-written extensions that provide invaluable added value.
The challenges
- Replacing the standard Wordpress administration tools (wp-admin) with role-tailored and fit-for-purpose tools for competition administrators and participants.
- Re-engineer the standard WordPress user management tools to assign users to competitions and categorise them by season, region, club, weight class, gender and experience level.
- Based on the rules of the sport, automate and simplify the process of creating match lists, recording match results and calculating scores and rankings.
What’s wrong with the WordPress administration tool?
We immediately saw the unreasonableness of letting all users into the WordPress administration tool, given all the information we needed to control in the programming and the limited possibilities to customise the interface and functionality of the administration tool. Instead, we decided to cherry-pick and only make available the functionality that users need with our own customised web interface.
Why change the way Wordpress handles users?
Expanding what data to store about each user is a relatively straightforward matter for a reasonably experienced Wordpress developer. The problem is that we also wanted to be able to control the user information in the programming and link it to our own information types. For example, the user should be the one who states their gender and weight in their user profile, while our programming logic sets the correct weight class based on that information. Another example is that when the user has stated which club they belong to, the system should read out which region the user belongs to based on the club’s regional affiliation.
The result
To show how the result turned out, we have chosen to make five short film clips; one showing how the administrator creates a competition event, one showing how to register a new user, one showing how the user registers for a competition, one showing how the administrator for a competition creates match lists and finally one showing how the administrator registers match results.
The technical solutions
NOTE! For those of you who are a little more technically interested in our solutions, I thought I’d tell you a little more about it here, the rest of you can skip this bit without feeling ashamed. 🙂
As the experienced web developer may have already noticed, we have been frequent users of the Bootstrap framework. Furthermore, we’ve been using a lot of jQuery and not just for visual effects. To reduce the number of clicks and page loads, we created our own API for AJAX calls that handles reading as well as writing to the database.
On the less visible side, we have an information architecture that places very specific requirements on the functions for reading and writing to the database. To help us, we have made extensive use of an extension called Taxonomy Metadata. With it, we have been able to expand the information associated with each taxonomy and term to, among other things, create relationships between information types that would otherwise have been impossible or very difficult.
However, with an increasingly complex information architecture, there are some problems with the standard WordPress feature of iterating through records, also known as “The Loop”. In short, too many loops in the loops make both Wordpress and developers dizzy. Another problem was Wordpress’ way of associating permalinks with which page template to display. We ended up extending the Wordpress permalink system and template framework to completely take control of which functions, variables and page templates to load for which permalink.
With some “dark programmer magic” we got a function that reads a simply crafted YAML file to set permalink rules and a function to hook page templates and functions on the permalink rules, all this before Wordpress understood which permalink is requested and which template to load. However, the solution is designed so that you can still load regular Wordpress templates as usual as well as you can choose to completely override them. In this way, we really pick the raisins out of the cake we call Wordpress.
Last but not least, it might be worth mentioning that we used an add-on called WordPress Social Login to allow users to register and log in with their Facebook or Google account.
The page the post is about can be found at: http://grapplingligan.se