From 7cae389accb0cb6b8a812627353021ad9dcd19ea Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Thu, 18 May 2017 07:31:43 +0000 Subject: [PATCH] Dashboard: Always pass the IP when getting events Allows the API to determine event locations more accurately. Props iandunn. See #40702. Built from https://develop.svn.wordpress.org/trunk@40774 git-svn-id: http://core.svn.wordpress.org/trunk@40632 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../includes/class-wp-community-events.php | 19 ++++++------------- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/wp-admin/includes/class-wp-community-events.php b/wp-admin/includes/class-wp-community-events.php index d3c6f08699..f388c3a957 100644 --- a/wp-admin/includes/class-wp-community-events.php +++ b/wp-admin/includes/class-wp-community-events.php @@ -137,13 +137,16 @@ class WP_Community_Events { * @access protected * @since 4.8.0 * - * @param string $search City search string. Default empty string. - * @param string $timezone Timezone string. Default empty string. + * @param string $search Optional. City search string. Default empty string. + * @param string $timezone Optional. Timezone string. Default empty string. * @return string The request URL. */ protected function get_request_url( $search = '', $timezone = '' ) { $api_url = 'https://api.wordpress.org/events/1.0/'; - $args = array( 'number' => 5 ); // Get more than three in case some get trimmed out. + $args = array( + 'number' => 5, // Get more than three in case some get trimmed out. + 'ip' => $this->maybe_anonymize_ip_address( $this->get_unsafe_client_ip() ), + ); /* * Send the minimal set of necessary arguments, in order to increase the @@ -161,16 +164,6 @@ class WP_Community_Events { if ( $search ) { $args['location'] = $search; - } else { - /* - * Protect the user's privacy by anonymizing their IP before sending - * it to w.org, and only send it when necessary. - * - * The w.org API endpoint only uses the IP address when a location - * query is not provided, so we can safely avoid sending it when - * there is a query. - */ - $args['ip'] = $this->maybe_anonymize_ip_address( $this->get_unsafe_client_ip() ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 3df01f6a47..17848f8e4a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.8-beta1-40773'; +$wp_version = '4.8-beta1-40774'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.