Motor Racing League

Plugin to manage and present prediction (fantasy) competitions for motor sport events.

Author:Ian Haycox (profile at wordpress.org)
WordPress version required:4.5
WordPress version tested:5.3.15
Plugin version:1.9.9
Added to WordPress repository:16-08-2009
Last updated:08-01-2020
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:100
Rated by:5
Plugin URI:http://www.ianhaycox.com/f1/
Total downloads:13 629
Active installs:80+
plugin download
Click to start download

This Plugin is designed to manage motor sport races and championships and allow users to predict the outcome
of the races. Points are awarded based on users’ predictions and the actual finishing order of the race.

Most motor sport competition types are supported. Basically any event that involves qualifying, then a race
with a finishing order. For example, Formula One, NASCAR, Moto GP, even possibly cycle races.

These types of prediction games are often referred to as Fantasy competitions.

If you do download this plugin please come back and rate it. For any rating less than 5 stars
I would love to hear your feedback to help improve the plugin. Usability issues, bugs, enhancements
and any other comments welcome to make this plugin better. Contact

Features

  • easy adding of championships, races and drivers/riders
  • entry form for users to make predictions for races on defined championships
  • sidebar widget to display prediction standings
  • multiple championships supported
  • pluggable modules to support multiple custom points calculations
  • countdown timer to next prediction deadline
  • option to limit only logged in users
  • display statistics for prediction frequencies
  • email prediction confirmations
  • email prediction reminders

New Features

Version 1.9.6

  • Added option to display notices at the top/bottom/both of entry form
  • Removed deprecated mysql_real_escape_string
  • Fixed ability to enter predictions after qualifying

Version 1.9.5

  • Fixed bug with scoring when ‘Use Race Points’ was checked. Only award points if the predicted and actual finishing positions match.

Version 1.9.4

  • New option [motorracingleague results=x used_doubleups=1] displays an extra table of players who have doubled up previously in the season.

Version 1.9.2

  • Added ignoredeadline option to statistics shortcode to display prediction statistics before the entry deadline has passed.

Version 1.8

  • Can predict Rain, Safety Car, DNF and Double Up points for one race. Contribution by gpwizard.co.uk.
  • New optional Qualifying Deadline to allow changes to race predictions after qualifying but before race start.
  • Hovering over race results and predictions shows a tooltip with the points breakdown for each race or prediction.

Version 1.7

  • Send reminder emails to users who have not predicted. Contribution by F1Fanatic.co.uk.

Version 1.3

  • Optionally send email confirmation for a players’ predictions
  • New shortcode to display the logged in players predictions

Version 1.2

  • Truncate long player names on display to prevent very wide tables
  • Scroll browser window to highlight invalid input
  • Mailing list opt-in feature for visitor predictions
  • New shortcode option to display prediction summary statistics.

Version 1.1 includes the following:-

  • option to predict pole lap time
  • option to predict fastest lap (or most laps led) driver
  • multiple configurable widgets to display race or championship scores
  • option to prevent loading of Javascript and CSS for pages and posts without a shortcode
  • logged in users can modify their predictions
  • custom scoring assignments without the need for a PHP module

** Shortcode changes **

The shortcodes [motorracingleague_x] and [motorracingleague_results_x] have been replaced by the shortcodes
[motorracingleague entry=x] and [motorracingleague results=x] respectively.

A new shortcode [motorracingleague race=x] has also been introduced for specific race results.

The old shortcode format will not work with this version. Please edit any old posts or pages to use the new
format. See the usage instructions for more details on shortcode syntax.

Translations

Also available in Spanish. – Thanks to Sammy.
Portuguese. Thanks to Willian.
and Polish. Thanks piotreklobcio

Other translations, help needed here.

Statistics

An additional plugin is available to display comprehensive race results for most forms of motor sport.
For more information see Motor Sport Results
Formula One race data from 1950 until 2012 is available for this plugin.

Usage

After installation use the Admin ‘Motor Racing’ settings option to create a championship.

  • Enter season and description, e.g. 2009, F1 World Championship
  • Number of predictions – The number of places a player must guess. A value of 3 would
    be; guess the top three finishers.
  • PHP Calculator – Leave blank for now.

Click on the Season to define the list of Drivers/Riders that participant in the championship.

Note, when defining a race you must supply the date and time, in YYYY-MM-DD HH:MM format for the entry deadline and
the race start time. Players cannot enter predictions after the deadline. It is safe therefore to leave the entry form
displayed as it will flip over to the next race after the deadline has passed.
Prediction results in the widget only include races after the race start time.

Be aware, of timezone issues. The date and times are entered in server local time, i.e. the timezone where your blog
is hosted. For races in other timezones, make the appropriate adjustment.

Options

  • Predict Pole – A player is required to predict the pole sitter
  • Predict Pole Time – A player must guess the pole sitters qualifying time
  • Predict Fastest Lap – A player is required to predict the driver who sets the fastest lap in the race
  • Display Most Laps Led – Display ‘Most Laps Led’ instead of ‘Fastest Lap’.
  • Predict Rain – A play may predict if this will be a wet or dry race
  • Predict Safety Car – Will the SC be deployed during the race
  • Predict DNF – Guess the number of ‘Did Not Finish’
  • Double Up – Choose one race to gain double points.
  • Cookie Seconds – After a prediction entry has been made a user must wait this many seconds before the
    entry form is available again, unless they delete the cookie. Basic prevention to avoid multiple predictions
    from a non-logged-in user. Default 500000 seconds (approx 6 days)
  • View predictions before entry – If checked allow users to view other peoples predictions before making their own.
  • Predictors must be logged in – Option to only allow logged in users to predict. Logged in users must have the ‘predict’
    capability as part of their WordPress role. By default all roles have the ‘predict’ capability.

Points Calculations

Points are awarding to players’ predictions depending on the settings made in the Championship
Scoring tab. Most settings should be self-explanatory.

  • Pole Lap Time – Assign points if a player guesses within a percentage of the actual time. The ‘Add more…’ button
    allows the addition of extra entries to create a sliding scale of guesses. For example, within 0.25% = 10 points, within 0.5%
    = 5 points. Note – 0% is an exact match to the millisecond.

  • Use Race Points – When “Use Race Points” is checked, players are awarded points from the race result for each
    prediction that matches. For example, player predicts Driver1 in second place. If Driver1 finishes fifth, then the
    player gains points for the fifth place finish.

  • Custom Scoring – An example PHP module is supplied to calculate players prediction points. Points are awarded very simply
    giving each player 10 points for correctly guessing the Pole Sitter, Pole Lap Time, Fastest Lap/Laps Led and 10 points each for correctly
    guessing the finishing position.

The example module, motorracingleaguepoints.php, can be used as a basis for your own scoring system.
To use your own, copy the default module and place the file in the new same directory as the
default module. Edit as desired and specify the filename as the Calculator in the championship.
Comments in the example module should be self explanatory.

If you can’t find a friendly PHP programmer then for a small donation I can create a points
module for you.

DO NOT edit the default module, it may be replaced on upgrades.

An alternative module, f1fanatic.co.uk.php, is another example. However this relies on the championship
being configured with four predictions per race. The pole sitter and top three finishers.

Race Completion

Once a specified race has finished, use the Race Result option to enter the finishing positions.

If you have checked the ‘Use Race Points’ option in Scoring, then enter points for each finishing position, otherwise
leave at zero.

The prediction points are updated according to the Scoring scheme chosen.

Users predictions can be viewed via the Predictions option.

Settings

  • Display promotion link – Add a link to my homepage if checked in the themes’ footer.

  • Max statistical positions – Limit the number of positions when showing statistics. The suggested value is 3 to show only
    the podium positions. Large numbers (usually greater than 6) can result
    in very slow database queries. Use 0 to set as the same as the number of predictions.

  • Allow the collection of users’ email addresses for those that check the opt-in checkbox.

  • Send a confirmation email of a players prediction – Enter a subject and a proforma email body. I don’t recommend setting this
    unless you require users to be logged in, otherwise emails could be send to any email address.

  • Send a reminder email to alert users of an impending race – Enter the number of hours before the entry deadline to send the remininder, a subject and a proforma email body.

  • For the first race of the season a reminder is sent to all registered users
  • For subsequent races, we send the reminders to all users who submitted predictions for any race in the current championship.
  • In both cases reminders are not send if the users has already predicted the current race, or a user has clicked the opt-out link.

Shortcodes

You can display the entry form with the following code in a post

[motorracingleague entry=x]

Replace x with the respective Championship ID to display. The entry form will display a countdown to the next
race deadline. Once expired then the race is removed from the dropdown options and the next race presented.
If the option to allow only logged in users to predict is enabled, the entry form does not present the player name and
email address fields. These are taken from their profile.

Display a table of the latest prediction standings with the following code in a post

[motorracingleague results=x]

Substitute x with the respective Championship ID to display. After each race is complete the results for all
previous races are shown with the points scored for each user. The optional parameter cols=n can be used to
display player names on the right hand side of the table when the table width is wider than the display
and a scroll bar is used to scroll horizontally. For example, cols=10 will add the player name on the
right hand side once the number of race results exceeds 10.

The optional parameter used_doubleups=1 will append an additional table to the results listing the players who
have used thier Double Up option during the season. The race and extra points awarded for using the double up is also shown.

Display a table with details for every players predictions for one race with the following

[motorracingleague race=x limit=n full=m]

Substitute x with the Race ID to be displayed. After the results for the race have been entered
this shows all the players predictions and score for the selected race. The parameters limit and
full are optional.

limit=n Where n is the maximum number of rows to display – 0 is no limit
full=m Where m = 1, show the players predictions, m = 0, just show points gained for the race.

Without limit and full, all results are shown with each prediction.

Display the currently logged in users’ predictions for all races in this championship

[motorracingleague predictions=x]

Substitute x with the respective Championship ID to display.

Display a short summary of prediction statistics. This is includes average pole lap time, most common predictions etc.
Prediction statistics are only shown for the races AFTER the prediction deadline has expired.

[motorracingleague stats=x ignoredeadline=0]

Substitute x with the respective Championship ID to display.
Prediction statistics are only shown once the entry deadline has passed. To show statistics before the entry
deadline has passed use ignoredeadline=1 This may give an advantage to some players as they will be able
to see the most common predictions before making thier own.

All shortcodes also take an optional style parameter to apply a CSS style to the table. For example,
[motorracingleague race=x style=”width:50%”]
will make the race results table narrower.

Widget

Drag and drop the widget to a sidebar and configure. Multiple instances of the widget, each configured separately, may be
placed on a sidebar.

If a championship id is entered then only the summary results for that championship are displayed.
If this is left blank, then all championships are displayed in the widget.

Leave race selection as ‘All Races’ to display summary results – same output as [motorracingleague results=x] Choosing
a specific race outputs data similar to [motorracingleague race=x]

If Show Predictions for Race, is checked, it displays the top n players scores and their predictions for the selected race.

If not blank the URL option adds a link to the full results page using the title below as the link text.