• marc2107

    (@marc2107)


    Is it possible to ad a dropdown menu of the different pools on the match prediction page?

    We have three pools and all players from all these three pools are shown in the same list.

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

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

    (@antoineh)

    Is it possible? Yes, but you’ll need to do some coding. There is a filter that can be used to limit the users that are shown. This example uses the filter to remove inactive players, but you can also change it to filter out users based on a selected league ID.

    Then all you need is a dropdown. Every page in the plugin also has a filter to add content. A (somewhat changed) example from the help page (untested):

     add_filter( 'footballpool_pages_html', 'add_dropdown', null, 2 );
    function add_dropdown( $content, $id ) {
    $dropdown = '';
    if ( $id === Football_Pool_Utils::get_fp_option( 'page_id_statistics', 0, 'int' ) ) {
    $dropdown = '<select name="league">
    <option value="1">test 1</option>
    <option value="2">test 2</option>
    </select><br>';
    }

    return "{$dropdown}{$content}";
    }

    You can make it a bit more complex by retrieving the leagues dynamically, but if they won’t change, then that might be overkill.

    Another option would be to just add 3 links to the same page but with the league ID in the querystring, and then use that value from the URL in your code to filter out the users.

    p.s. I noticed on your website that your teams are not all labelled as ‘real’ teams. You can see this, when you go to the groups page.

    Thread Starter marc2107

    (@marc2107)

    Hi! Unbelievable the service you provide! Such quick responses!! However, I think you are overestimating my skills. So I think I should go with the 3 links. Can you help me along with the strings? I tried adding “?league=2&_submit=ga” but that doesn’t do the job….

    If you don’t want to help anymore I can understand, no problem!!!

    Greetings,
    Marc

    Plugin Author AntoineH

    (@antoineh)

    I think I have most of what you want already in another old extension. If I can find some time this week(end) I will try to combine the code snippets in one extension plugin.

    Plugin Author AntoineH

    (@antoineh)

    I created something. Took a bit longer than expected because I realized that I also had to filter the chart on that page and also the bonus question view. Hope this is useful.

    You should use links that are formatted like this: ?view=matchpredictions&match=1&league=2

    Thread Starter marc2107

    (@marc2107)

    Hi Antoine, although I am very sure this is perfectly working, I have no idea how to implement this on my site. So I’ll just leave it like it is, or switch off the posibility to see everyones predictions.
    Thanks for all your effort!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Predictions’ is closed to new replies.