foreach ($conf_ob->hooks[$scope_ob->scope] as $name) {
try {
- $value = Horde::callHook('prefs_init', array($name, $this->_params['user']), $scope_ob->scope);
- if (!is_null($value)) {
- $scope_ob->set($name, $value);
- }
+ $scope_ob->set($name, Horde::callHook('prefs_init', array($name, $scope_ob->get($name), $this->_params['user']), $scope_ob->scope));
} catch (Horde_Exception_HookNotSet $e) {}
}
* ----------------------
* If the 'hook' parameter is non-empty for a preference (config/prefs.php),
* the prefs_init hook will be run on login to allow alteration of the value.
- * This hook receives the preference name and the username as parameters and
- * uses the return value from the hook as the new preference value. If null
- * is returned, the original preference value is used.
+ * This hook receives the preference name, preference value, and the username
+ * as parameters and uses the return value from the hook as the new preference
+ * value.
*
* This hook is ONLY executed on login and preferences are cached during a
* users' session.
class Horde_Hooks
{
// // PREFERENCES INIT: See above for documentation.
-// public function prefs_init($pref, $username = null)
+// public function prefs_init($pref, $value, $username = null)
// {
// switch ($pref) {
// case 'from_addr':
* PREFERENCE INIT: Set preference values on login.
*
* See horde/config/hooks.php.dist for more information.
- *
- * @param string $username The username.
- *
- * @return string The prefrence value.
*/
-// public function prefs_init($pref, $username = null)
+// public function prefs_init($pref, $value, $username = null)
// {
// if (!$username) {
// return;
// return json_encode(array_keys($sources));
// }
//
-// return $GLOBALS['prefs']->getValue($pref);
+// return $value;
// }
// }