Using PPP, I was trying to retrieve the Country Name set in the normal Web User interface via the ACP. In the ACP, it will show the name for the country selected, but when I use [+country+] to retrieve the name, it gives the ID (which happens to be 223, for United States). Is there a different way of doing this to make it get the name, or will I have to make a separate field for people to manually input in their country?
You can use create a snippet.
[[countryName]]
<?php
$basePath = $modx->config['base_path'];
include($basePath.'/manager/includes/lang/country/english_country.inc.php');
$id=$modx->getLoginUserID();
$userCountry = $modx->getWebUserInfo($uid=$id);
$myCountry= $_country_lang[$userCountry['country']];
return $myCountry;
?>
Or maybe assign it a to a placeholder? I just started with MODx last week. I got this code from copying and pasting from different threads and guessing.
DropboxUploader -- Upload files to a Dropbox account.
DIG -- Dynamic Image Generator
gus -- Google URL Shortener
makeQR -- Uses google chart api to make QR codes.
MODxTweeter -- Update your twitter status on publish.
Herre is some cleaner code, based on
Breezer’s answer for displaying avatars
http://modxcms.com/forums/index.php/topic,14842.0.html
Like the above code it was intended for a protected page for the logged in users info/
<?php
// Display Country Name
if(isset($_SESSION['webValidated'])){
$basePath = $modx->config['base_path'];
include($basePath.'/manager/includes/lang/country/english_country.inc.php');
$output ="";
$uid = $modx->getLoginUserID();
$wuser = $modx->getWebUserInfo($uid);
$wuser_country_code = $wuser['country'];
$output = $_country_lang[$wuser_country_code ];
}
return $output;
?>
This could be modified to accept an id of a user and pass a parameter to return the Country name too.
DropboxUploader -- Upload files to a Dropbox account.
DIG -- Dynamic Image Generator
gus -- Google URL Shortener
makeQR -- Uses google chart api to make QR codes.
MODxTweeter -- Update your twitter status on publish.
could this be modded to retreive authors country for pages made by webusers (via NewsPublisher)?