Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dparker1005/dd13edd52605129cdacb93263a45ce60 to your computer and use it in GitHub Desktop.
Save dparker1005/dd13edd52605129cdacb93263a45ce60 to your computer and use it in GitHub Desktop.
Formats address in Members List page for international addresses (i.e. Zip City) without looking at the State field
<?php
//Add from here down to the bottom of your PMPro Customizations plugin
add_action('pmpro_formatted_address', 'pmpro_custom_members_list_address', 10, 9);
function pmpro_custom_members_list_address( $address, $name, $address1, $address2, $city, $state, $zip, $country, $phone ) {
$address = '';
if ( ! empty( $name ) ) {
$address .= $name . '<br/>';
}
if ( ! empty( $address1 ) ) {
$address .= $address1 . '<br/>';
}
if ( ! empty( $address2 ) ) {
$address .= $address2 . '<br/>';
}
if ( ! empty( $zip ) ) {
$address .= $zip;
if ( ! empty( $city ) ) {
$address .= ' ' . $city;
}
$address .= '<br/>';
} elseif ( ! empty( $city ) ) {
$address .= $city . '<br/>';
}
if ( ! empty( $country ) ) {
$address .= $country . '<br/>';
}
if ( ! empty( $phone ) ) {
$address .= formatPhone( $phone );
}
return $address;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment