http://www.mediawiki.org/wiki/Special:Code/MediaWiki/61088
Revision: 61088 Author: ashley Date: 2010-01-15 17:23:51 +0000 (Fri, 15 Jan 2010) Log Message: ----------- SocialProfile: display city for non-default countries in user profile Modified Paths: -------------- trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php Modified: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php =================================================================== --- trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php 2010-01-15 16:55:00 UTC (rev 61087) +++ trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php 2010-01-15 17:23:51 UTC (rev 61088) @@ -218,10 +218,22 @@ } $profile_data = $this->profile_data; + $defaultCountry = wfMsgForContent( 'user-profile-default-country' ); + $location = $profile_data['location_city'] . ', ' . $profile_data['location_state']; - if ( $profile_data['location_country'] != 'United States' ) { - $location = ''; - $location .= $profile_data['location_country']; + if ( $profile_data['location_country'] != $defaultCountry ) { + if ( $profile_data['location_city'] && $profile_data['location_state'] ) { // city AND state + $location = $profile_data['location_city'] . ', ' . + $profile_data['location_state'] . ', ' . + $profile_data['location_country']; + } elseif ( $profile_data['location_city'] && !$profile_data['location_state'] ) { // city, but no state + $location = $profile_data['location_city'] . ', ' . $profile_data['location_country']; + } elseif ( $profile_data['location_state'] && !$profile_data['location_city'] ) { // state, but no city + $location = $profile_data['location_state'] . ', ' . $profile_data['location_country']; + } else { + $location = ''; + $location .= $profile_data['location_country']; + } } if ( $location == ', ' ) { @@ -229,10 +241,21 @@ } $hometown = $profile_data['hometown_city'] . ', ' . $profile_data['hometown_state']; - if ( $profile_data['hometown_country'] != 'United States' ) { - $hometown = ''; - $hometown .= $profile_data['hometown_country']; + if ( $profile_data['hometown_country'] != $defaultCountry ) { + if ( $profile_data['hometown_city'] && $profile_data['hometown_state'] ) { // city AND state + $hometown = $profile_data['hometown_city'] . ', ' . + $profile_data['hometown_state'] . ', ' . + $profile_data['hometown_country']; + } elseif ( $profile_data['hometown_city'] && !$profile_data['hometown_state'] ) { // city, but no state + $hometown = $profile_data['hometown_city'] . ', ' . $profile_data['hometown_country']; + } elseif ( $profile_data['hometown_state'] && !$profile_data['hometown_city'] ) { // state, but no city + $hometown = $profile_data['hometown_state'] . ', ' . $profile_data['hometown_country']; + } else { + $hometown = ''; + $hometown .= $profile_data['hometown_country']; + } } + if ( $hometown == ', ' ) { $hometown = ''; } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs