Richard

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • in reply to: Location search: where do the suggestions come from? #1180895
    Richard
    Participant

    Thanks!

    in reply to: Location search: where do the suggestions come from? #1180800
    Richard
    Participant

    OK, I have this working on the dev site – hooray!

    * Edited wp-config.php to add this line:

    define(‘SCRIPT_DEBUG’, true);

    (That’s so it runs my edited version of the JavaScript, rather than the out-of-the-box minified version.)

    * Edited wp-content/plugins/events-calendar-pro/src/resources/js/tribe-events-pro.js and added line 272, so that the start of process_geocoding now looks like this:

    process_geocoding: function( location, callback ) {

    var request = {
    address: location,
    bounds : new google.maps.LatLngBounds(
    new google.maps.LatLng( TribeEventsPro.geocenter.min_lat, TribeEventsPro.geocenter.min_lng ),
    new google.maps.LatLng( TribeEventsPro.geocenter.max_lat, TribeEventsPro.geocenter.max_lng )
    ),
    region: ‘uk’, // <<<<< Added this line
    };

    // etc.

    And, after reloading the page and making sure I wasn’t using a cached page that had loaded the minified version, it work!

    I’ve not attempted to add a setting to configure the region; your guys will know those parts of your code far better than I do.

    I’m guessing that this setting would ultimately end up being sent to the page in the “TribeEventsPro” object that is part of the inline script generated by enqueue_pro_scripts() in wp-content/plugins/events-calendar-pro/src/Tribe/Main.php

    /**
    * Enqueue the proper PRO scripts as necessary.
    *
    * @return void
    */
    public function enqueue_pro_scripts() {
    if ( tribe_is_event_query() ) {
    // @TODO filter the tribe_events_resource_url() function
    $path = Tribe__Events__Pro__Template_Factory::getMinFile( tribe_events_pro_resource_url( ‘tribe-events-pro.js’ ), true );
    wp_enqueue_script(
    ‘tribe-events-pro’,
    $path,
    array(
    ‘jquery’,
    ‘tribe-events-calendar-script’,
    ),
    apply_filters( ‘tribe_events_pro_js_version’, self::VERSION ),
    false
    );

    $geoloc = Tribe__Events__Pro__Geo_Loc::instance();

    $data = array(
    ‘geocenter’ => $geoloc->estimate_center_point(),
    ‘map_tooltip_event’ => __( ‘Event: ‘, ‘tribe-events-calendar-pro’ ),
    ‘map_tooltip_address’ => __( ‘Address: ‘, ‘tribe-events-calendar-pro’ ),
    ‘region’ => ‘uk’, // <<<<< Added this; it should be retrieved from The Events Calendar Pro settings
    );

    $data = apply_filters( ‘tribe_events_pro_localize_script’, $data, ‘Tribe__Events__Pro__Main’, ‘tribe-events-pro’ );

    wp_localize_script( ‘tribe-events-pro’, ‘TribeEventsPro’, $data );

    }
    }

    and then picked up in tribe-events-pro.js like this:

    process_geocoding: function( location, callback ) {

    var request = {
    address: location,
    bounds : new google.maps.LatLngBounds(
    new google.maps.LatLng( TribeEventsPro.geocenter.min_lat, TribeEventsPro.geocenter.min_lng ),
    new google.maps.LatLng( TribeEventsPro.geocenter.max_lat, TribeEventsPro.geocenter.max_lng )
    ),
    region: TribeEventsPro.region, // <<<<< Added this line
    };

    // etc.

    in reply to: Location search: where do the suggestions come from? #1180404
    Richard
    Participant

    OK – you’re using the Google Maps Javascript API’s Geocoder class, and it looks like that’s where the USA bias is coming from.

    Looking at the Google API documentation, there’s an optional parameter “region” which they describe as “Country code used to bias the search, specified as a Unicode region subtag / CLDR identifier.”

    Comparing the returned data from http://maps.googleapis.com/maps/api/geocode/json?address=birmingham and http://maps.googleapis.com/maps/api/geocode/json?address=birmingham&region=uk it looks like that may well be what we need.

    Perhaps it might be possible to add an option in the Events Calendar preferences, allow us to optionally set a region?

    in reply to: Update issues to Avada 5.0 #1178597
    Richard
    Participant

    Thanks Hunter!

    in reply to: Update issues to Avada 5.0 #1176461
    Richard
    Participant

    Also reported at https://theeventscalendar.com/support/forums/topic/tec-pro-4-3-release/ – this seems to be because the returned data from tribe_get_venue_details() has changed in The Events Calendar 4.3

    Formerly:
    Array ( [name] => Peterborough Arena
    [address] => East of England Showground
    Peterborough, PE2 6XE United Kingdom )

    Now:
    Array ( [linked_name] => Peterborough Arena
    [address] => East of England Showground
    Peterborough, PE2 6XE United Kingdom )

    I reported this to Avada, who are on the case, but I’m not clear why name has been changed to linked_name in 4.3 in the returned array. Is this an intentional change, I wonder? (Can’t see it in the release notes; tribe_get_venue_details() is part of the documented API so I’m surprised the returned data has changed without it being noted somewhere.)

    in reply to: Add multiple dates/times for same event #1175793
    Richard
    Participant

    Same question here – I’m only seeing the “Same Time” checkbox for “Custom” recurrence rules, which only support setting an end date, not a start date. If it appeared when the recurrence rule type was “Date”, or if “Custom” recurrence rules could specify a start date, I’d be sorted.

Viewing 6 posts - 1 through 6 (of 6 total)