• Plugin Author AntoineH

    (@antoineh)


    Update: Because my dropbox links stopped working, I created this new topic for the extension examples.

    Note: Please do not reply in this topic. This topic is only for posting extensions. If you have a question or would like to report a problem about an extension, please open a new topic!

    During the last couple of years I have helped several users with all kind of requests to alter the working of the plugin. When I change the plugin’s behavior I try use hooks as much as possible. Because when you use hooks, then an upgrade of the plugin won’t overwrite your code changes.

    The help page in the plugin contains some examples and also links to some resources on the internet that can help you make your own additions to the plugin.

    But because I also made some myself, I decided to write this post to share them with you.

    One important note: some of these extensions are very old, so it is possible that some won’t work anymore in the plugin. Maybe the hook is gone or the functionality made it to the core of the plugin, making the extension useless. But the file may still be valuable as an example for you.

    Template (empty example)
    If you want to use the hooks in the plugin you have to place your code somewhere so WordPress can pick it up. One place you can put your code is the functions.php of your theme, but I personally prefer writing a simple plugin that you can simply activate/deactivate. I created a file that you can use as a start to create your own plugin.
    football-pool-extension-template.php

    • This topic was modified 7 years, 7 months ago by AntoineH.
    • This topic was modified 7 years, 7 months ago by AntoineH.
Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author AntoineH

    (@antoineh)

    Add match result to User page
    As the name says: it adds the match result to the page where you can see the predictions for a user.
    football-pool-add-match-result-to-user-page.php

    Plugin Author AntoineH

    (@antoineh)

    Change what the ranking looks like
    This is a simple example on how you can change what you want to show in the ranking. This extension always shows the league image in the ranking. If you want to change the looks for the view for all users, you will have to check the variable $all_user_view. The $type variable that is passed to the function tells you if the ranking is displayed in the page, the shortcode or the widget.
    football-pool-change-ranking-template.php

    Plugin Author AntoineH

    (@antoineh)

    Login names in ranking
    This extension shows the login name of users in the ranking instead of the display name.
    football-pool-login-names-in-ranking.php

    Plugin Author AntoineH

    (@antoineh)

    Change the display of user names everywhere in the plugin
    The plugin normally shows the display name for a user in the plugin (e.g. the ranking, the shoutbox, etc.). But it is very easy to change this to another field in the User object or if you would like to add extra HTML code.
    football-pool-username-extension.php

    Plugin Author AntoineH

    (@antoineh)

    Change the score calculation (v2.5 and up)
    Since version 2.5 changing the way the plugin calculates the score has become very simple. This example also rewards the goal diff points when the match ended in a draw and the user predicted a draw.
    football-pool-extension-change-calc-score.php

    Plugin Author AntoineH

    (@antoineh)

    Change the prediction form HTML
    Just two simple examples on how you can change the prediction form. The first one adds a save button to the top of the form. The second one changes every row in the form and adds a save button in the row.
    football-pool-extra-match-save-button-at-top.php
    football-pool-extra-match-save-buttons.php

    Plugin Author AntoineH

    (@antoineh)

    Order match predictions
    Order match predictions by score and don’t show users without predictions.
    football-pool-matchpredictions-order.php

    Plugin Author AntoineH

    (@antoineh)

    Only show ‘open’ matches on the form
    If you want to hide matches that can’t be changed anymore in the form, you can use this extension. It simply filters out the matches in the form that are no longer editable for a user and returns this set to the function that creates the form.
    football-pool-only-open-matches.php

    Plugin Author AntoineH

    (@antoineh)

    Pagination
    Also in the help page of the plugin. A simple function that adds pagination to the ranking, matches and prediction page of the plugin. Useful if you have a lot of data and don’t want to show everything on one page.
    football-pool-pagination.php

    Plugin Author AntoineH

    (@antoineh)

    Prediction upload
    This extension adds a new menu item in the Football Pool admin. The new admin screen enables you to upload predictions for matches for a user. The data format of the prediction file is csv and every line should contain the match ID, score of home team and score of away team. First line of the csv contains the header and is ignored. No jokers can be imported, but this would be a small change to also enable that.
    football-pool-user-prediction-import-v2.php
    example csv file

    Plugin Author AntoineH

    (@antoineh)

    Golden Games (v2.5 and up)
    This extension disables the Joker functionality for users and allows the admin to select 1 or more games as ‘golden game’. A golden game will award extra points as the scored points will be multiplied by the joker multiplier value in the settings.
    A new admin screen is added to the Football Pool admin to set the golden games. Matches that are labeled as golden game can be styled in the frontend with the CSS class fp-golden-game.
    football-pool-golden-games.php

    Plugin Author AntoineH

    (@antoineh)

    Change ranking order
    Sometimes players end up with the same amount of points scored. The plugin handles this in the ranking by making the amount of full scores more important than the amount of toto scores (and some other rules). This extension shows how simple it is to also include the amount of goal diff points in the determination of the order. It does this with simple string inserts in the SQL that calculates the order in the calculation process. But you could also change the fields in the SQL or just rewrite the entire SQL.
    football-pool-extension-change-ranking-order.php

    Plugin Author AntoineH

    (@antoineh)

    Shortcode [fp-scores]
    I created a simple shortcode that displays a table with a set of users (vertical) and the scores for a given set of matches (horizontal). Code is not optimized and it needs some custom CSS styling because the table can get very large for multiple matches and/or a large user set.
    This extension registers the shortcode, so you can use it in your content.

    parameters:

    //[fp-scores]
    //  Displays the scores for every user for one or more matches.
    //
    //  Users, match & matchtype arguments can be entered in the following formats (example for matches):
    //        match 1               -> match="1"
    //        matches 1 to 5        -> match="1-5"
    //        matches 1, 3 and 6    -> match="1,3,6"
    //        matches 1 to 5 and 10 -> match="1-5,10"
    //
    //    league    : the league to get the users from, defaults to the overall league
    //    users     : collection of user ids, if set then league setting is ignored
    //    match     : collection of match ids 
    //    matchtype : collection of match type ids

    download here:
    football-pool-shortcode-fp-scores.php

    Plugin Author AntoineH

    (@antoineh)

    Report
    The following example shows a simple way to show data from an SQL query in the admin (for reporting/information). It adds an extra page in the Football Pool menu and outputs the query results in a table. The query in the example shows number of predictions per user, but you can show any information if you change the $sql variable to your query.

    football-pool-admin-report.php

    Plugin Author AntoineH

    (@antoineh)

    User Search
    This example adds a very basic user search to the ranking page. Use it as an example for your specific needs.

    football-pool-add-user-search-on-ranking-page.php

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Extension plugins for the Football Pool plugin’ is closed to new replies.