WordPress.org

Forums

Football Pool
[resolved] Countdown Widget Refresh for next game? (3 posts)

  1. soundboard6
    Member
    Posted 1 year ago #

    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

  2. AntoineH
    Member
    Plugin Author

    Posted 1 year ago #

    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
    }
  3. soundboard6
    Member
    Posted 1 year ago #

    Works perfectly! Thanks! Great plugin!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Football Pool
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.