Title: pekos's Replies | WordPress.org

---

# pekos

  [  ](https://wordpress.org/support/users/pekos/)

 *   [Profile](https://wordpress.org/support/users/pekos/)
 *   [Topics Started](https://wordpress.org/support/users/pekos/topics/)
 *   [Replies Created](https://wordpress.org/support/users/pekos/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/pekos/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/pekos/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/pekos/engagements/)
 *   [Favorites](https://wordpress.org/support/users/pekos/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 82 total)

1 [2](https://wordpress.org/support/users/pekos/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/pekos/replies/page/3/?output_format=md) 
[4](https://wordpress.org/support/users/pekos/replies/page/4/?output_format=md) 
[5](https://wordpress.org/support/users/pekos/replies/page/5/?output_format=md) 
[6](https://wordpress.org/support/users/pekos/replies/page/6/?output_format=md) 
[→](https://wordpress.org/support/users/pekos/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Change template](https://wordpress.org/support/topic/change-template-15/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/change-template-15/#post-17850996)
 * Hi Antoine
 * this works as expected so once again thank you.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Preparing for the next round](https://wordpress.org/support/topic/preparing-for-the-next-round/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/preparing-for-the-next-round/#post-17849349)
 * Ok Thank you
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Change template](https://wordpress.org/support/topic/change-template-15/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/change-template-15/#post-17848511)
 * Hi Antoine
 * regarding placing the code in an extension (plugin) or in functions.php, we are
   on the same track. For testing purposes i am using the functions.php method, 
   but the final product will be an extension as you prefer.
 * Now regarding the code, this is what I ended up doing, however I am 100% sure
   that the code can be improved. For example the $pool variable should be global
   and available to template_start, template_row.
 * Also i am not sure if the $match_info is already available or what I am doing
   is correct i.e. define the same logic [SQL query] as yours to get the $match_info
   details.
 * Nevertheless, see my working code below, and feel free, should you have enough
   time, to make edits.
 *     ```wp-block-code
       <?php/** * Plugin Name: Football Pool Match Predictions * Description: Overwrites for the Match Predictions view templates. * Version: 1.0 * Author: Antoine Hurkmans * Author URI: mailto:wordpressfootballpool@gmail.com * License: MIT *//******************************************************* *    HOW TO USE THIS PLUGIN * * 1. Save this file in the /wp-content/plugins folder. * 2. Activate the plugin via the Plugins screen in the WP admin. * *******************************************************/add_filter( 'plugins_loaded', ['FootballPoolMatchPredictionsViewTemplate', 'init_extension'] );class FootballPoolMatchPredictionsViewTemplate {    public static function init_extension() {        // Display a message if the Football Pool plugin is not activated.        if ( ! class_exists( 'Football_Pool' ) ) {            add_action( 'admin_notices', [__CLASS__, 'no_fp_plugin_error'] );            return;        }        // The three filters for the individual templates        add_filter( 'footballpool_matchpredictions_template_start', [__CLASS__, 'template_start'], 10, 2 );        add_filter( 'footballpool_matchpredictions_template_end', [__CLASS__, 'template_end'], 10, 2 );        add_filter( 'footballpool_matchpredictions_row_template', [__CLASS__, 'template_row'], 10, 2 );    }    public static function template_start( $template_start, $match_info ) {        global $wpdb, $pool;        $prefix = FOOTBALLPOOL_DB_PREFIX;        $sql = "SELECT                    m.home_team_id, m.away_team_id,                    p.home_score, p.away_score, p.has_joker, u.ID AS user_id, u.display_name AS user_name ";        if ( $pool->has_leagues ) $sql .= ", l.id AS league_id ";        $sql .= "FROM {$prefix}matches m                LEFT OUTER JOIN {$prefix}predictions p                    ON ( p.match_id = m.id AND m.id = %d )                RIGHT OUTER JOIN {$wpdb->users} u                    ON ( u.ID = p.user_id ) ";        if ( $pool->has_leagues ) {            $sql .= "INNER JOIN {$prefix}league_users lu ON ( u.ID = lu.user_id )                    INNER JOIN {$prefix}leagues l ON ( l.id = lu.league_id ) ";        } else {            $sql .= "LEFT OUTER JOIN {$prefix}league_users lu ON ( lu.user_id = u.ID ) ";            $sql .= "WHERE ( lu.league_id <> 0 OR lu.league_id IS NULL ) ";  }        $sql .= "ORDER BY u.display_name ASC";        $sql = $wpdb->prepare( $sql, $match_info['id'] );        $predictions = $wpdb->get_results( $sql, ARRAY_A );        $rows = apply_filters( 'footballpool_statistics_matchpredictions', $predictions, $match_info );        $layout_class = $pool->match_table_layout === 0 ? 'classic-layout' : 'new-layout';        $template_start = sprintf( '<style>                                        table.tablesorter thead tr th {border:0;}                                    </style>                                    <table class="matchinfo match-%d %s statistics tablesorter">                                        <thead>                                            <tr>                                                <th class="custom-username">%s</th>                                                <th colspan="%d" class="custom-prediction sortless">%s</th>                                                <th class="custom-score">%s</th>                                            </tr>                                        </thead>'            , $match_info['id']            , $layout_class            , __( 'name', 'football-pool' )            , ( $pool->has_jokers ? 4 : 3 )            , __( 'prediction', 'football-pool' )            , __( 'score', 'football-pool' )        );        return $template_start;    }    public static function template_end( $template ) {        return '<!-- PEKOS --></tbody></table>';        //return $template;    }    public static function template_row( $template ) {        $template_row = '<tr class="%current_user_css_class%">                        <td><a href="%user_url%">%user_name%</a></td>                        <td class="home">%home_score%</td>                        <td class="match-hyphen">-</td>                        <td class="away">%away_score%</td>                        <td class="score"><span class="user-points">%score%</span></td></tr>';        //if ($pool->has_jokers) {$row_template .= '<td title="%joker_title_text%"><div class="nopointer %joker_css_class%"></div></td>';}        //$row_template .= '<td class="score"><span class="user-points">%score%</span></td></tr>';        return $template_row;    }    public static function no_fp_plugin_error() {        $plugin_data = get_plugin_data( __FILE__ );        $plugin_name = $plugin_data['Name'] ?? __CLASS__;        echo "<div class='error'><p>The Football Pool plugin is not activated. ",            "Make sure you activate it so the extension plugin '{$plugin_name}' has some use.</p></div>";    }}
       ```
   
 * Thank you in advance
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Change template](https://wordpress.org/support/topic/change-template-15/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/change-template-15/#post-17847190)
 * Well it is not only the span with class I need to insert there…
 * Even though the string replace function seems OK for other functionalities, in
   this one I need to introduce other changes in the template which are mainly for
   styling reasons.
 * However, it has now came to my attention that I would like to also change the
   template html start and introduce `<thead>` after the `<table>` and make the `
   th` elements part of the `<thead>` element.
   In this way I can use the “table 
   sorter” plugin which requires that thead is correctly declared in the table structure.
 * In order to achieve the above I suppose I don’t need an football pool extension
   plugin rather I can use a PHP snippet to do so right ? Would you be able to provide
   the code I a looking for ?
 * Thank you
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Sorting the results](https://wordpress.org/support/topic/sorting-the-results-2/)
 *  [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/sorting-the-results-2/#post-17846865)
 * thank you [@fanman1948](https://wordpress.org/support/users/fanman1948/)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Sorting the results](https://wordpress.org/support/topic/sorting-the-results-2/)
 *  [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/sorting-the-results-2/#post-17846802)
 * Hi [@fanman1948](https://wordpress.org/support/users/fanman1948/) & [@antoineh](https://wordpress.org/support/users/antoineh/)
 * can you please share location for **Football Pool Sort Match Predictions** ?
 * If this is in dropbox, is there a main download location with all plugins listed?
 * Thanx
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Wise Chat] messages not loading](https://wordpress.org/support/topic/messages-not-loading/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/messages-not-loading/#post-17827115)
 * Hi
 * the new version 3.3.1 breaks my site. I can live with 3.2 for now.
 * Thanx
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Column type charts](https://wordpress.org/support/topic/column-type-charts/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/column-type-charts/#post-17821178)
 * Hi Antoine
 * well it actually does make the difference. This is the new chart type i got after
   uploading the file you sent me.
 * ![](https://i0.wp.com/i.ibb.co/yk71P91/Screenshot-2024-06-12-235420.png?ssl=1)
 * So, once again, i have to thank you for troubleshooting quickly and successfully.
 * If you need for any tests or reports from my side, I will help you.
 * I did not answer before, but I did not see any errors in the console.
 * Thank you
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Column type charts](https://wordpress.org/support/topic/column-type-charts/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/column-type-charts/#post-17820139)
 * Just checked with earlier version and I still get the same chart type (not the
   column-chart)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Column type charts](https://wordpress.org/support/topic/column-type-charts/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/column-type-charts/#post-17820129)
 * Latest…. I will try to upload earlier version and come back to you… However please
   do also a check on your side if there is need to update json or class.
 * Thanx
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Column type charts](https://wordpress.org/support/topic/column-type-charts/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/column-type-charts/#post-17819953)
 * This is exactly the same as what I have in my page:
 * `<div id="chart6-wrapper" class="chart-wrapper column-chart chart stats-page"
   >`
 * Is something else like a json object controlling the type of charts which is 
   missing or udpated in later highchart version?
 * Thanx
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Display all score type on match result page](https://wordpress.org/support/topic/display-all-score-type-on-match-result-page/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/display-all-score-type-on-match-result-page/#post-17812557)
 * Hi Antoine
 * this is clear. I will try your suggestion.
 * Something out of subject: in the help page of the plugin you are mentioning some
   simple examples such as the following :
 *     ```wp-block-code
       <?php
       // only show the first 20 users in the user selector
       add_filter( 'footballpool_userselector_widget_users', function ( $a ) {
           return array_slice( $a, 0, 20 );
       } );
       ?>
       ```
   
 *  However i found out that the correct way for the filter to work is as per the
   following:
 *     ```wp-block-code
       <?php// only show the first 20 users in the user selectoradd_filter( 'footballpool_userselector_users', function ( $a ) {    return array_slice( $a, 0, 20 );} );?>
       ```
   
 * Maybe you might need to change the help page for this specific matter.
 * Thank you
    -  This reply was modified 1 year, 11 months ago by [pekos](https://wordpress.org/support/users/pekos/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Charts cannot be displayed.](https://wordpress.org/support/topic/charts-cannot-be-displayed/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/charts-cannot-be-displayed/#post-17811678)
 * Hi Antoine
 * it was actually due to the simple calculation method setting.
 * Thanx for the quick reply
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Show all predictions](https://wordpress.org/support/topic/show-all-predictions/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/show-all-predictions/#post-16249464)
 * Hi Antoine
 * thank you for the response. That was indeed the problem. I disabled the plugin
   and the page works as expected.
 * Thank you
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Football Pool] Show all predictions](https://wordpress.org/support/topic/show-all-predictions/)
 *  Thread Starter [pekos](https://wordpress.org/support/users/pekos/)
 * (@pekos)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/show-all-predictions/#post-16247175)
 * Hi Antoine
 * let me explain.
 * A user that is registered and allowed to participate in a league, when logged
   in can visit the predictions page (not the prediction form page). On that page,
   he can see his predictions, but the page only shows future matches. What I need
   is for the user to see all the predictions he has made so far. Therefore I am
   not talking about another page other than the predictions page, I am saying that
   the predictions page shows only the predictions submitted for future matches 
   while it should show predictions for matches already played.
    A user can see 
   all predictions made from all users if he goes to the matches page and clicks
   on the actual result, then he is directed to a page where the predictions for
   the specific match from all users are shown even if the match has already been
   played. Therefore I believe there is a logic that prevents past matches from 
   being displayed on the current user’s predictions page.
 * Thank you
    Periklis

Viewing 15 replies - 1 through 15 (of 82 total)

1 [2](https://wordpress.org/support/users/pekos/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/pekos/replies/page/3/?output_format=md) 
[4](https://wordpress.org/support/users/pekos/replies/page/4/?output_format=md) 
[5](https://wordpress.org/support/users/pekos/replies/page/5/?output_format=md) 
[6](https://wordpress.org/support/users/pekos/replies/page/6/?output_format=md) 
[→](https://wordpress.org/support/users/pekos/replies/page/2/?output_format=md)