Merge pull request #260 from kadimi/patch-1

Fix PHP Warning (Illegal string offset 'outcome')
This commit is contained in:
ThemeBoy
2018-05-04 08:52:12 +10:00
committed by GitHub

View File

@@ -629,6 +629,9 @@ class SP_Event extends SP_Custom_Post{
$outcomes = get_posts( $args ); $outcomes = get_posts( $args );
foreach ( $meta as $team => $team_results ) { foreach ( $meta as $team => $team_results ) {
if ( $outcomes ) { if ( $outcomes ) {
if ( empty( $meta[ $team ] ) ) {
$meta[ $team ] = array();
}
$meta[ $team ][ 'outcome' ] = array(); $meta[ $team ][ 'outcome' ] = array();
foreach ( $outcomes as $outcome ) { foreach ( $outcomes as $outcome ) {
$meta[ $team ][ 'outcome' ][] = $outcome->post_name; $meta[ $team ][ 'outcome' ][] = $outcome->post_name;