[dev] [PATCH] Identity hooks
Bernard Blackham
b-horde at blackham.com.au
Mon Jan 26 09:48:28 PST 2004
I'd like to get back the old _prefs_hook_fullname functionality, so
I've integrated a few lines into Identity.php which lets you
nominate a hook for any identity property. Using this, to create a
fullname hook, you'd define
$conf['hooks']['identity']['fullname'] = true;
and a function _identity_hook_fullname() that returns the fullname.
It only acts on identities that don't otherwise have the requested
property - this may or may not be generally desirable. I am using
it so that when a user logs in, it will say something like "Welcome,
Bernard Blackham" instead of "Welcome, blackb02 at some.server.com".
Comments appreciated :)
Bernard.
--
Bernard Blackham <bernard at blackham dot com dot au>
-------------- next part --------------
--- ../framework/Identity/Identity.php.orig Tue Jan 27 01:12:14 2004
+++ /usr/share/php/Horde/Identity.php Tue Jan 27 01:45:46 2004
@@ -172,6 +172,8 @@
*/
function getValue($key, $identity = null)
{
+ global $conf;
+
if (!isset($identity) || !isset($this->_identities[$identity])) {
$identity = $this->_default;
}
@@ -184,6 +186,11 @@
}
} else {
$val = $this->_identities[$identity][$key];
+ }
+
+ if (!empty($conf['hooks']['identity'][$key]) && empty($val)) {
+ include_once HORDE_BASE . "/config/hooks.php";
+ return call_user_func("_identity_hook_$key");
}
return $val;
More information about the dev
mailing list