WordPress.org

Make WordPress Core

Ticket #41112: 41112.diff

File 41112.diff, 1.4 KB (added by metalandcoffee, 3 years ago)
  • src/wp-admin/includes/class-wp-community-events.php

    diff --git a/src/wp-admin/includes/class-wp-community-events.php b/src/wp-admin/includes/class-wp-community-events.php
    index 79c4a85adb..b9262f2134 100644
    a b class WP_Community_Events { 
    416416        }
    417417
    418418        /**
    419          * Discards expired events, and reduces the remaining list.
     419         * Trims events list to prepare it for presentation.
    420420         *
     421         * Discards expired events, forces first WordCamp to appear first
     422         * and reduces the remaining list.
     423         *
     424         * @access protected
    421425         * @since 4.8.0
    422426         *
    423427         * @param  array $response_body The response body which contains the events.
    class WP_Community_Events { 
    427431                if ( isset( $response_body['events'] ) ) {
    428432                        $current_timestamp = current_time( 'timestamp' );
    429433
     434                        $wordcamps = array();
    430435                        foreach ( $response_body['events'] as $key => $event ) {
     436                                if ( empty( $wordcamps ) ) {
     437                                        if ( 'wordcamp' === $event['type'] ) {
     438                                                array_push( $wordcamps, $event );
     439                                                unset( $response_body['events'][ $key ] );
     440                                        }
     441                                }
    431442                                // Skip WordCamps, because they might be multi-day events.
    432443                                if ( 'meetup' !== $event['type'] ) {
    433444                                        continue;
    class WP_Community_Events { 
    440451                                }
    441452                        }
    442453
     454                        $response_body['events'] = array_merge( $wordcamps, $response_body['events'] );
     455
    443456                        $response_body['events'] = array_slice( $response_body['events'], 0, 3 );
    444457                }
    445458