Hi Reinis,
I get the idea: you want to add some disadvantage to the top players so it (hopefully) makes it easier for the lower ranked players to catch up.
I have to think about it for a bit, because both are not possible right now. And I foresee some problems because it would require to load the ranking on some parts of the plugin where I would rather not add this extra sql query (because it is the slowest query in the plugin). So my first thought would be to not include it in the vanilla plugin. But maybe as an extension.
I think having the variable lock time is the easiest as it would only require one place to change the code (and then extend on that part with an extension that overwrites the setting). Checking for multiple saves also requires a database change to store the time when a save was done by the player. And I also do not like the idea of locking the form when a player accidentally saves it with the wrong numbers.
Yes, you got that completely right, it’s for a disadvantage for top players, so others could possibly catch up on final games.
Which ever solution is better, is good by me. As far as you’ve got the idea, I believe you’ll come up with the best solution.
You’ve helped me out a lot before with extensions, so your support is at it’s finest as it has always been 🙂
I played around a bit with the idea and came up with the following extension.
This extension also requires a hook in the Football_Pool_Matches class to work. I will add the hook in my next version of the plugin (v2.9.6 or higher), but to immediately start using the extension you’ll have to change the following line in that class file:
$this->lock = Football_Pool_Utils::get_fp_option( 'maxperiod', FOOTBALLPOOL_MAXPERIOD, 'int' );
to:
$this->lock = apply_filters( 'footballpool_matches_lock_maxperiod',
Football_Pool_Utils::get_fp_option( 'maxperiod', FOOTBALLPOOL_MAXPERIOD, 'int' ) );
You can change the lock times to your liking via the array definition in the extension. You can add as much ranks as you wish, e.g. (example is for top 3 players):
private static $variable_lock_times = [
// format of array: ranking (int) => seconds for lock time (int)
1 => 1 * HOUR_IN_SECONDS,
2 => 45 * MINUTE_IN_SECONDS,
3 => 30 * MINUTE_IN_SECONDS,
];
Amazing, yet again you have proven, that’s support for this plugin is excellent.
I’m going to do some testing today, will see how this works out, then I’m gonna give my feedback 🙂
Ok, so I tested it, and everything works like a charm.
I almost had finished my reply how it doesn’t work, but then thought of testing it again. For my surprise, I wanted to do the testing in the wrong way. I was the only one in the ranking, meaning no other player were participants in pool, and with settings like that, this extension doesn’t work, but when I added my test user to pool thus making ranking with at least two player (me as 1st place, test as 2nd) then everything was fine, so mistake on my side 🙂
You can tag this as resolved. Many thanks to you Antoine!