Horde Recipe: Storing the last login language

A simple Horde Hook to store the last chosen login value in a user preference.
You can use this for example to determine in which language automatic messages by cron job or daemon should be sent.

// // APPLICATION AUTHENTICATED HOOK: See above for format.
public function appauthenticated()
{
global $language;
global $prefs;
if ($language) {
$prefs->setValue('language', $language);

}

// // Code to run when an application is first authenticated
}

If you want, you can modify it so it won’t overrule manual settings in the prefs UI:


if ($language && empty($prefs->getValue('language')) {
$prefs->setValue('language', $language);

}

Leave a Reply

Your email address will not be published. Required fields are marked *