Merge pull request #292 from kadimi/patch-22

Refactor
This commit is contained in:
Brian Miyaji
2018-10-04 11:34:17 +10:00
committed by GitHub

View File

@@ -579,16 +579,14 @@ class SP_Event extends SP_Custom_Post{
$appointments = array();
foreach ( $duties as $duty ) {
$duty_appointments = sp_array_value( $officials, $duty->term_id, null );
$duty_appointments = sp_array_value( $officials, $duty->term_id, array() );
if ( ! $include_empty && empty( $duty_appointments ) ) continue;
$appointed_officials = array();
if ( is_array( $duty_appointments ) ) {
foreach ( $duty_appointments as $duty_appointment ) {
$appointed_officials[ $duty_appointment ] = get_the_title( $duty_appointment );
}
foreach ( $duty_appointments as $duty_appointment ) {
$appointed_officials[ $duty_appointment ] = get_the_title( $duty_appointment );
}
if ( $include_empty && empty( $appointed_officials ) ) $appointed_officials[] = $placeholder;