[horde] Custom Defaults / Hooks

Jan Schneider jan at horde.org
Wed Jul 20 12:17:35 UTC 2011


Zitat von Adam Tauno Williams <awilliam at whitemice.org>:

> Quoting Jan Schneider <jan at horde.org>:
>> Zitat von Adam Tauno Williams <awilliam at whitemice.org
>>> I my horde/config/prefs.local.php I've defined two defaults like:
>>> $_prefs['ldap_userdn'] = array(
>>>   'locked' => false,
>>>   'type' => 'text',
>>>   'desc' => _("LDAP Distinguished Name of user object"),
>>>   'hook' => true
>>> );
>>> $_prefs['ldap_usercn'] = array(
>>>   'locked' => false,
>>>   'type' => 'text',
>>>   'desc' => _("CN of user object"),
>>>   'hook' => true
>>> )
>>> Then in horde/config/hooks.php I've added a simple test to see if the
>>> hook ever gets hit; and it doesn't .  Can I have hooks for 'custom'
>>> defaults or do I need to register them somehow beyond inclusion in the
>>> prefs.local.php -
>>> hooks.php
>>> -------------------------
>>> class Horde_Hooks
>>> {
>>> //    // PREFERENCES INIT: See above for documentation.
>>>   public function prefs_init($pref, $value, $username, $scope_ob)
>>>   {
>>>       syslog(LOG_ALERT, "Horde hook for pref: " . $pref);
>>> That syslog statement never appears in the log
>> Why should they be called for arbitrary prefs you added?
>
> Because the documentation says:
>
> <QUOTE>
>  * 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, preference value, username, and
>  * the master scope object (Horde_Prefs_Scope) as parameters and uses the
>  * return value from the hook as the new preference value
> </QUOTE>
>
> "hook will be run on login"

Ah, right, I was wrong. I incorrectly assumed that the hooks are only  
run on-demand, i.e. when the value is actually received.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the horde mailing list