Plugin to manage and present prediction (fantasy) competitions for motor sport events.
After installation use the Admin 'Motor Racing' settings option to create a championship.
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.
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.
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.
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.
You can display the entry form with the following code in a post
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
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
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.
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
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.