• Resolved lentini84

    (@lentini84)


    hi,

    I noticed that in the “audit log” panel, where I can monitor who submitted which predictions, several users have appeared whom the system marks as “unknown.” This wasn’t the case before. I checked all the users one by one, thinking maybe their name wasn’t displayed (because they didn’t have it set), but that’s not the problem. So where did these “unknown” users come from, and will the system count their points?

    Thanks in advance for the help!

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

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

    (@antoineh)

    The plugin logs the user ID in the database for the audit log, not the name. And the audit log admin page uses the same function that is used on other parts of the plugin to display the user name based on that ID. To be honest, I can’t think of a reason why the wrong ID would be saved.

    Did you perhaps remove some users from the pool? Because that could explain the ‘unknown user’ references. If not, then only inspecting the data in the database might give some insights on what is happening.

    p.s. I will add the user ID to the audit log in a next version. That may help in debugging issues.

    Thread Starter lentini84

    (@lentini84)

    Hi 🙂 Antoine, 1,500 people participate in my darts pool. Unfortunately, the website isn’t working properly when it comes to posting results. Is there any way I can help? Maybe you’re familiar with WordPress? 🙂

    Best regards

    Plugin Author AntoineH

    (@antoineh)

    Can you give a bit more information? Which part of the plugin is not working properly? Do you see any errors on the screen or in your error log?

    Thread Starter lentini84

    (@lentini84)


    Ultimately, it turned out that the problem was the login module 😉

    But I have another question – I have 3,000 users on my website. They’re all assigned to the rankings. Is there an easy way to ensure that only those who have submitted their predictions actually appear in the rankings?

    Plugin Author AntoineH

    (@antoineh)

    I have an extension plugin that hides inactive users. You can download it here.

    Some instructions on how to activate the plugin.

    Thread Starter lentini84

    (@lentini84)

    Great, thank you.

    Is there one place where I can find all the extensions? Okay, I know there is one: https://ww.wp.xz.cn/support/topic/extension-plugins-for-the-football-pool-plugin/, but I couldn’t find an extension there that removes inactive people from the rankings. Hence the question: is there a place where I can find all the extensions?

    Plugin Author AntoineH

    (@antoineh)

    Most extensions are mentioned here on the forum, but unfortunately the search is terrible. 😉

    I have one place where I’ve stored all extensions over the past years: here.

    But a disclaimer: extensions are not actively maintained, so I can’t guarantee that they all still work. Some could even have started as an extension, but eventually made it to the plugin. So, use with care.

    Extensions are always meant to be an inspiration. If they do not do exactly what you want, you might be able to change it to your needs (ChatGPT/Claude is your best friend).

    Thread Starter lentini84

    (@lentini84)

    Great.

    I have three more questions:

    1. I installed the Search User Ranking plugin. The table does indeed display a window where I can enter the user’s details, but after clicking Enter, I get a message that my WordPress site has a critical error. Have there been any reports like this before?

    2. I installed a plugin that removes people from the rankings who didn’t submit a prediction. But is there a way to have the statistics for a given match show only those who predicted the match, not all registered players?

    3. I installed a plugin that shows how many jokers a person has used. That’s all good, but if the table only shows a number, it’s hard for some people to understand what it refers to. Is it possible to add the word “joker” there, or preferably a joker icon (highlighted or not).

    Thanks in advance for your answers 🙂

    Thread Starter lentini84

    (@lentini84)

    I managed to solve tasks 1 and 3. That leaves task number 2 🙂

    Plugin Author AntoineH

    (@antoineh)

    I don’t have a plugin that filters out users without a prediction, but I do have one that filters based on league. So, I did a little experiment.

    1. Uploaded the plugin to ChatGPT and gave it this prompt:
      I have a php wordpress plugin that filters users from a page based on the league that they are in. I want to change the file to filter users away that do not have a prediction for a match. The rest of the functionality can be stripped from the plugin. Can you help me change the plugin?
    2. The result was a new plugin file that I tested by activating it. Unfortunately, it gave a database error and a non-working pie chart. Easiest solution was to strip that function as well, because there is no need to filter that data set. So, I gave a new prompt:
      The filtering worked well, I only see the users that have a prediction. But I also got a database error on the page and the chart doesn’t work. You can completely remove the filter for the pie chart. There is no need to filter that data set. And you can change the author of the plugin to ChatGPT because you did all the work 🙂 Can you give me the end result?

    This was the end result and it does exactly what I want 🙂

    <?php
    /**
    * Plugin Name: Football Pool Filter Stats (Predictions Only)
    * Description: Shows only users that have submitted a prediction for a match.
    * Version: 2.0
    * Author: ChatGPT
    * License: MIT
    */

    add_filter( 'plugins_loaded', [ 'FootballPoolFilterStatsByPrediction', 'init_extension'] );

    class FootballPoolFilterStatsByPrediction {

    public static function init_extension() {
    // Check if Football Pool plugin exists
    if ( ! class_exists( 'Football_Pool' ) ) {
    add_action( 'admin_notices', [__CLASS__, 'no_fp_plugin_error'] );
    return;
    }

    // Filter match predictions (main table only)
    add_filter( 'footballpool_statistics_matchpredictions', [__CLASS__, 'filter_stats_view' ] );
    }

    /**
    * Only keep entries that actually have a prediction
    */
    public static function filter_stats_view( $predictions ): array
    {
    return array_filter( $predictions, function( $p ) {
    return (
    isset( $p['home_score'] ) &&
    isset( $p['away_score'] ) &&
    $p['home_score'] !== '' &&
    $p['away_score'] !== ''
    );
    } );
    }

    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. ",
    "Activate it so '{$plugin_name}' works.</p></div>";
    }
    }
    Thread Starter lentini84

    (@lentini84)

    Thanks!!

Viewing 11 replies - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.