Support » Plugin: Football Pool » Ranking Page: new columns

  • Resolved psike64

    (@psike64)


    Great work, beautiful plugin!

    I would like to display all columns of values that, by adding them, make up the full score.
    I’ll tell you better: I would also like to see toto score, goal bonus and goal difference.
    Is it possible to add these columns?

    If you want, I’ll create a test user to show you my site entirely

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author AntoineH

    (@antoineh)

    Hi,

    The required data can be retrieved from the database and then added to the data set and template for the ranking using an extension plugin (just like the one you’re using now for the number of predictions), but I am afraid that retrieving the data (per user in the ranking) will slow down the processing of the ranking a lot.

    edit: If all data is retrieved in one query and then stored in the WP cache, then it shouldn’t have a big impact on performance of the ranking.

    • This reply was modified 2 years, 2 months ago by AntoineH.

    I thank you for the answer.
    Unfortunately I do not know the php and even sql and honestly i am in trouble modifying or adding the code.
    I seem to have realized that I should add lines of code to the file “football-pool-show-number-prediction-and-avatar.php”
    Would you be so kind to edit that file or create a new one with the necessary code for me?
    Please… 🙂

    Plugin Author AntoineH

    (@antoineh)

    I will give it a try.
    Can you send me the original file? Or post the code here?

    I just worked on CSS, I did not even touch a line of code.
    If I understand correctly, the lines of code that you are referring to are the following:

    <?php

    /**
    * Plugin Name: Football Pool show number prediction and avatar
    * Description: Show number of predictions in the ranking table and also the user avatar.
    * Version: 1.0
    * Author: Antoine Hurkmans
    * Author URI: mailto:wordpressfootballpool@gmail.com
    * License: MIT
    */

    // Show number of predictions in the ranking table and also the user avatar.
    // If you want the page, shortcode or widget to have different layouts,
    // you can differentiate with the $type.

    add_filter( ‘footballpool_ranking_template_start’,
    function( $template_start, $league, $user, $ranking_id, $all_user_view, $type ) {
    // add a row with column headers
    $template_start .= sprintf( ‘<tr>
    <th></th>
    <th class=”user”>%s</th>
    <th class=”num-predictions”>%s</th>
    <th class=”score”>%s</th>
    %s</tr>’
    , __( ‘user’, ‘football-pool’ )
    , __( ‘predictions’, ‘football-pool’ )
    , __( ‘points’, ‘football-pool’ )
    , ( $all_user_view ? ‘<th></th>’ : ” )
    );
    return $template_start;
    }, null, 6 );
    add_filter( ‘footballpool_ranking_ranking_row_template’, function( $template, $all_user_view, $type ) {
    if ( $all_user_view ) {
    $ranking_template = ‘<tr class=”%css_class%”>
    <td style=”width:3em; text-align: right;”>%rank%.</td>
    <td>%user_avatar%%user_name%</td>
    <td class=”num-predictions”>%num_predictions%</td>
    <td class=”ranking score”>%points%</td>
    <td>%league_image%</td>
    </tr>’;
    } else {
    $ranking_template = ‘<tr class=”%css_class%”>
    <td style=”width:3em; text-align: right;”>%rank%.</td>
    <td>%user_avatar%%user_name%</td>
    <td class=”num-predictions”>%num_predictions%</td>
    <td class=”ranking score”>%points%</td>
    </tr>’;
    }
    return $ranking_template;
    }, null, 3 );
    ?>

    Plugin Author AntoineH

    (@antoineh)

    I tried something. Hope it works.
    Download PHP file here.

    Perfect!!!

    it works perfectly!
    I also worked through CSS on the widget, eliminating the columns that fit the view.
    now finally the participants can see how they get the total score, with their partial scores.

    thanks for your time!
    I would have other improvements to suggest, can I still disturb you? 🙂

    Plugin Author AntoineH

    (@antoineh)

    You can always open a new topic or send me an email with suggestions. No problem.

    psike64 (@psike64)

    How did you make such a beautiful table?

    masterfootball (@masterfootball)
    working through CSS, adapting it to my theme. 🙂

    if you want to take a look at the entire site as a user, you can log in with these credentials:

    user: test
    pwd: test-2017
    I will keep this account active for a week.
    let me know what you think.

    the site is still under test and the official tournament has yet to start

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Ranking Page: new columns’ is closed to new replies.