Support

Home Forums Event Espresso Premium "Unknown" and GB appearing in venue address when viewing event

"Unknown" and GB appearing in venue address when viewing event

Posted: May 15, 2015 at 4:24 am

Viewing 5 reply threads


Jonathan

May 15, 2015 at 4:24 am

The “edit venue” page requires a state/province.

Not all countries have states/provinces (e.g. UK).

If USA or Canada (for example) are enabled in the “Countries” tab, then for UK addresses you have to leave the state/province blank (as none exist).

But when viewing an event, it displays “Unknown, ” as part of the address if a state/province has not been chosen.

I have now enabled only the UK, but it still causes the same problem.

It also inserts “GB, ” into the address. This is incorrect:
1. If the address is to have the country, it should appear at the very end.
2. The UK is made up of GB (England, Scotland, Wales) plus Northern Ireland.
3. I’ve never seen the abbreviation GB used in addresses even within GB.


Lorenzo Orlando Caum

  • Support Staff

May 15, 2015 at 8:51 am

Hi Jonathan, could you try adding these filters to your child theme’s functions.php file or a site specific plugin?

https://eventespresso.com/topic/address-still-now-showing-correctly/#post-152845


Lorenzo


Jonathan

May 15, 2015 at 9:21 am

That partly solves one of the two problems, thanks.

1. “GB” problem. Now it says “United Kingdom” which is fine BUT it should appear at the end of the address (not before the postcode).

2. “Unknown” problem. I know I could edit all venues to ensure that something is added to the state/province field, but it should be easier to fix the “Unknown” problem.


Lorenzo Orlando Caum

  • Support Staff

May 15, 2015 at 9:40 am

Hi Jonathan, is that order related to the front-end display for the venue address?

If so, you can actually customize the formatting of the address and here is an example:

https://eventespresso.com/topic/address-still-now-showing-correctly/#post-143031


Lorenzo


Jonathan

May 15, 2015 at 10:17 am

This is really something that should be built-in (as the way the address appears by default is just no good for the UK) but the code below did the trick for my purposes. Thanks for the help.

function espresso_venue_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) {
    EE_Registry::instance()->load_helper( 'Venue_View' );
    $venue = EEH_Venue_View::get_venue( $VNU_ID );
    if ( $echo ) {
        echo '<div>' . $venue->address(); 
	if ($venue->address2()!='') echo ', ' . $venue->address2();
	if ($venue->city()!='') echo ', ' . $venue->city();
	if ($venue->state_name()!='Unknown') echo ', ' . $venue->state_name();
	if ($venue->zip()!='') echo ', ' . $venue->zip();
	echo '</div>';
        return '';
    }
    return EEH_Venue_View::venue_address( $type, $VNU_ID );
}


Lorenzo Orlando Caum

  • Support Staff

September 12, 2015 at 11:25 am

Hi Jonathan,

We wanted to let you know about an enhancement in the current version of Event Espresso 4 that offers more flexibility for venue addresses.

First, please backup your WordPress site and upgrade to the latest release of Event Espresso 4:

https://eventespresso.com/wiki/ee4-changelog/

Next, there is some sample code in this link:

https://gist.github.com/lorenzocaum/5e2658a1f7e7a9a6b5c0

Here is an explanation of the sample code:

In the older versions of Event Espresso, you could change the formatting for the venue address. However, this would apply to all venue addresses. The new enhancement is more flexible as it allows you to change the formatting for certain countries.

In the example code, we have an entry for United Kingdom which has a country code of GB. Then we have the actual formatting which doesn’t include the province or the country name.

Just below that, we have an entry for Canada which has a country code of CA. In Canada, the zip/postal code appears as the end of the address so the formatting will show it in that order.

If you have modified the venue address through an existing function, then you may consider switching to the new one mentioned in the link above.

Thanks!


Lorenzo

Viewing 5 reply threads

The support post ‘"Unknown" and GB appearing in venue address when viewing event’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso