Frontend\Core\Engine\TemplateModifiers::userSetting PHP Method

userSetting() public static method

Get the value for a user-setting syntax {{ usersetting($setting, $userId) }}
public static userSetting ( string $string = null, string $setting, integer $userId = null ) : string
$string string The string passed from the template.
$setting string The name of the setting you want.
$userId integer The userId, if not set by $string.
return string
    public static function userSetting($string = null, $setting, $userId = null)
    {
        $userId = $string !== null ? (int) $string : (int) $userId;
        $setting = (string) $setting;
        // validate
        if ($userId === 0) {
            throw new Exception('Invalid user id');
        }
        // get user
        $user = User::getBackendUser($userId);
        // return
        return (string) $user->getSetting($setting);
    }