Good afternoon,
I am looking for help with shortcode [fp-match-scores]. I would like to have team flags instead of names (space reasons), but I couldn’t find a way how to do it.
I tried to edit code from shortcode_last_predictions, where it come datas from database to select also home_team_id and use him to get team_flag, but it didn’t happend, when I applied home_team_flag instead of original home_team.
I tried to use home_team_id instead of home_team and it gave me the team ID, so how I am able to change the function to get from home_team_id home_team_flag?
Thank you in advance.
/**From public static function shortcode_last_predictions( $atts )**/
$prefix = FOOTBALLPOOL_DB_PREFIX;
$sql = "SELECT p.user_id, p.match_id, p.home_score, p.away_score, home.flag AS home_team_flag
FROM {$prefix}predictions p
INNER JOIN {$prefix}matches m ON ( m.id = p.match_id )
INNER JOIN {$prefix}teams home ON ( home.id = m.home_team_id )
WHERE p.user_id IN ( {$user_set} )
ORDER BY m.play_date DESC, m.id DESC";
$rows = $wpdb->get_results( $sql, ARRAY_A );
$output .= '<div class="fp-last-predictions">';
$matches = $pool->matches;
$prev_match = $match = 0;
foreach( $rows as $row ) {
$user = $pool->user_name( (int) $row['user_id'] );
$match = (int) $row['match_id'];
$home_team_id = (int) $row['home_team_id'];
$away_team_id = (int) $row['away_team_id'];
$home_team_flag = Football_Pool_Utils::xssafe( $row['home_team_flag'] );
$home_team = Football_Pool_Utils::xssafe( $matches->matches[(int) $row['match_id']]['home_team'] );
$away_team = Football_Pool_Utils::xssafe( $matches->matches[(int) $row['match_id']]['away_team'] );
}
/**From shortcode_scores edit home_team to home_team_flag**/
// only continue if we have some data to show
if ( count( $the_users ) > 0 && count( $the_matches ) > 0 ) {
$output .= '<div class="shortcode fp-match-scores">';
$output .= '<table class="shortcode fp-match-scores"><thead><tr>';
$output .= '<th class="player-name"></th>';
foreach ( $the_matches as $match ) {
if ( $pool->matches->always_show_predictions || $match['match_is_editable'] === false ) {
$output .= sprintf( '<th class="match"><div class="break"><span>%s - %s</span></div>'
, Football_Pool_Utils::xssafe( $match['home_team_flag'] )
, Football_Pool_Utils::xssafe( $match['away_team'] )
