/**
* Output a profile setting
* syntax: {{ profilesetting($string, $name) }}
*
* @param string $string The variable
* @param string $name The name of the setting
*
* @return string
*/
public static function profileSetting($string, $name)
{
$profile = FrontendProfilesModel::get((int) $string);
if ($profile === false) {
return '';
}
// convert into array
$profile = $profile->toArray();
// @remark I know this is dirty, but I couldn't find a better way.
if (in_array($name, array('display_name', 'registered_on', 'full_url')) && isset($profile[$name])) {
return $profile[$name];
} elseif (isset($profile['settings'][$name])) {
return $profile['settings'][$name];
} else {
return '';
}
}