Making WordPress.org

Changeset 14645


Ignore:
Timestamp:
01/30/2026 06:30:12 AM (7 months ago)
Author:
dd32
Message:

Official Events: When a WordCamp has an invalid value in the 'Location' field, attempt to fill it in based on the available venue fields.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/official-wordpress-events.php

    r14558 r14645  
    387387                                }
    388388
     389                                // Correct any WordCamp events that have an invalid location specified.
     390                                if ( $event['location'] != 'online' && ! str_contains( $event['location'], ',' ) ) {
     391                                        $geocoded_location = implode(
     392                                                ',',
     393                                                array_filter(
     394                                                        array(
     395                                                                $wordcamp['_venue_city'] ?: $event['location'],
     396                                                                $wordcamp['_venue_country_name'] ?: $wordcamp['_host_country_name'],
     397                                                        )
     398                                                )
     399                                        );
     400
     401                                        if ( $geocoded_location ) {
     402                                                $event['location'] = $geocoded_location;
     403                                        }
     404                                }
     405
     406                                // Ensure end timestamp is never before start timestamp.
    389407                                if ( $event['start_timestamp'] ) {
    390408                                        if ( empty( $event['end_timestamp'] ) || $event['end_timestamp'] < $event['start_timestamp'] ) {
Note: See TracChangeset for help on using the changeset viewer.