Fix borrowed players not loading on event edit

This commit is contained in:
Brian Miyaji
2017-03-17 18:06:22 +11:00
parent b6f00110c1
commit 6dd9784073

View File

@@ -173,7 +173,16 @@ class SportsPress_Lazy_Loading {
$posts = sp_get_posts( $post_type, $args );
$post_ids = wp_list_pluck( $posts, 'ID' );
$diff = array_diff( $post_ids, $selected );
$borrowed = array_diff( $selected, $post_ids );
$selected = array_flip( $selected );
if ( sizeof( $borrowed ) ) {
$args = array( 'post__in' => $borrowed );
$borrowed_posts = sp_get_posts( $post_type, $args );
if ( is_array( $borrowed_posts ) ) {
$posts += $borrowed_posts;
}
}
?>
<div id="<?php echo $slug; ?>-all" class="posttypediv tabs-panel wp-tab-panel sp-tab-panel sp-ajax-checklist sp-select-all-range" style="display: <?php echo $display; ?>;">
<input type="hidden" value="0" name="<?php echo $slug; ?><?php if ( isset( $index ) ) echo '[' . $index . ']'; ?>[]" />