I am using the pool on a wordpress multisite build that hosts 2-3 pools. I’m running into an issue where my leaderboard and stats are showing all the users associated with the multisite network, and not just the users associated with that subsite.
Is there a way to filter those users out of each site’s leaderboard and stats, or do all names need to appear? If that’s not possible, can I add them to a league after the fact so I can utilize shortcodes? I dont’ see an easy way to do that now.
You can always divide users into leagues. There is a bulk action on the User admin screen to move multiple users at once. And then use shortcodes to show filtered rankings.
According to documentation you should also be able to filter on which site a user is on. So, you might be able to use this to extend my plugin. There are some examples on the forum where I filter the users.
I did a quick test with the stats pages and you can filter those. Only problem is that I don’t have a multisite install, so can’t properly test it without spending some time setting it up. With the help of some AI I got to this plugin: filter users by site. Hope it works 😉
For the ranking you’ll still need the leagues setup and use the shortcode.
What wasn’t working: On multisite, the ranking page was still showing users from other blogs.
So we hook three filters.
footballpool_ranking_array (for the fp-ranking shortcode)
footballpool_ranking_users (mostly useless, just to keep data consistent)
footballpool_print_ranking_ranking (which fires right before render, after league users are added) is what actually strips off-site users. Since each row’s rank is a sequential number assigned before our filter, removing users left gaps (1, 2, 5, 8…), so in that same hook also we re-sequence back the user-rank.
The gotcha: We don’t filter get_pool_ranking() itself, because its result is cached in a single global (non per-blog) entry — filtering there would leak one site’s view into others. That global cache also means the core football-pool plugin wasn’t really designed or tested for multisite, so expect and make sure to test for other leaks beyond the ranking page.
This reply was modified 1 week, 4 days ago by Manuel Razzari. Reason: Typos and formatting
I’ve installed this plugin and activated on my subsite, but now I get the following error:
Looks like the individual games stats and questions stats filter out everyone, but the stats page itself is now broken. I’ve tried with AI (Claude) to troubleshoot, but it doesn’t seem to find the bug.