Which add-on exactly are you using? I have so many itβs hard to tell which one you are referring to π
Plugin Name: Football Pool Sort Match Predictions
Yes, that is actually pretty easy. I can show you an example tonight. Basically boils down to adding an extra value to the $predictions array (e.g. 1 for the people with a prediction and 0 for those who didnβt). The logic for this is already in that add-on (as part of the remove inactive users). And with this value added to the array, you can use it in the sorting callback as a second sorting parameter for the spaceship operator (meaning when points are the same, then use this new value first to divide the players).
Hi @fanman1948 & @antoineh
can you please share location for Football Pool Sort Match Predictions ?
If this is in dropbox, is there a main download location with all plugins listed?
Thanx
@fanman1948 add the following line to your add_score function:
$prediction['user_has_prediction'] = ( is_null( $prediction['home_score'] ) || is_null( $prediction['away_score'] ) ) ? 0 : 1;This will add a β1β to the array for people that have entered a prediction, and β0β for those who didnβt.
And then change the sorting rule in sort_table() to this:
return [$b['score'], $b['user_has_prediction'], $a['user_name']] <=> [$a['score'], $a['user_has_prediction'], $b['user_name']];This should do the trick.
