Site settings override

You can override any site settings through out the site. Forexample without actually chaning the value of settings in database. You wanted to change the settings called langauge you can use this hook. The usecase is site langauge set to en and user language set to de but the system looking for langauge key.

<?php
function my_component_init(){
		ossn_add_hook('load:settings', 'language', 'ossn_site_user_lang_code');
}
function ossn_site_user_lang_code($hook, $type, $lang, $params) {
		if(ossn_isLoggedin()) {
				$user = ossn_loggedin_user();
				if(isset($user->language)) {
						$lang = $user->language;
				}
		}
		return $lang;
}
ossn_register_callback('ossn', 'init', 'my_component_init');