Support » Plugin: Football Pool » Countdown Widget Refresh for next game?

  • Resolved soundboard6

    (@soundboard6)


    After a game is played, the countdown widget does not begin counting down to the next game by the selected team. Instead, it begins to count UP showing how much time has elapsed since the game:

    “started 1 days, 9 hours, 56 minutes, 23 seconds ago”

    I am surprised how many updates there have been and suspect this has been fixed but I’m worried about updating during the tournament. Is there a simple fix for this?

    http://www.worldcupfundraiser.com

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

    (@antoineh)

    Yesterday someone pointed that out to me. It’s a bug in the widget when you select a team. The fix is simple, change the function get_next_match() in the /classes/class-football-pool-matches.php file with the one below:

    public function get_next_match( $ts = null, $team_id = null ) {
    	if ( $ts == null ) $ts = time();
    
    	$next_match = null;
    	foreach ( $this->matches as $match ) {
    		if ( $match['match_timestamp'] > $ts
    				&& ( $team_id == null || $team_id == $match['home_team_id'] || $team_id == $match['away_team_id'] ) ) {
    			$next_match = $match;
    			break;
    		}
    	}
    
    	return $next_match; // null if no match is found
    }

    Works perfectly! Thanks! Great plugin!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Countdown Widget Refresh for next game?’ is closed to new replies.