[horde] prefs_hook for an horde application - is it possible?
Matthias Rolke
m.rolke at linux-ag.com
Mon Jun 8 06:53:05 UTC 2009
Quoting "Michael Rubinsky" <mrubinsk at horde.org>:
>
> Quoting Jan Schneider <jan at horde.org>:
>
>> Zitat von Matthias Rolke <m.rolke at linux-ag.com>:
>>
>>> Hi there,
>>> i'm currently trying to determine the value of a user preference by a
>>> hook.
>>> This is pretty easy for preferences in the scope 'horde' and thus being
>>> configured in horde/config/hooks.php, horde/config/prefs.php.
>>> But in my case, i want to determine a preference value for an
>>> horde application.
>>>
>>> So, i created a prefs_hook in my "application/config/hooks.php"
>>> and enabled it in
>>> "application/config/prefs.php" like it is described in
>>> "horde/config/prefs.php".
>>>
>>> But the problem, afaik, is that the preference hooks are only
>>> being executed
>>> on login.
>>> "NOTE 2: Preferences hooks are ONLY executed on login."
>>> (horde/config/hooks.php)
>>>
>>> And sadly on login, the application preferences are not being loaded.
>>
>> That's because that sentence is not exactly correct. What it means
>> is that the hooks are only executed once after login, because the
>> prefs are only loaded once after the login. And the prefs for an
>> application are only loaded if the application is accessed.
>>
>>> So, my question is the following:
>>> Is there any possibility to determine a value for a preference value for
>>> an application?
>>>
>>> If you're interested, here is my exact case:
>>> * I'm using Kolab as the source for addressbooks in turba
>>> * The default_dir for every user should be his/her personal Kolab
>>> addressbook, stored in the personal Kolab mailbox
>>> * The source type name for that personal addressbook is "kolab"
>>> (see turba/config/sources.php), but for the user
>>> the default_dir value has to be an uid like user at example.com (the
>>> name of the kolab mailbox)
>>> * therfore only a hook would determine the right value for the
>>> "default_dir" preference for each user
>>
>> What you try to do should work, just not right after the login, but
>> as soon as the user accesses Turba.
>>
>> Jan.
>>
>> --
>> Do you need professional PHP or Horde consulting?
>> http://horde.org/consulting/
>
> Not sure if it's relevant to your particular case, but there was a
> recent fix to how the prefs hooks work - I believe it only affected
> prefs that were marked as shared, but you might want to check it out
> to be sure.
>
> http://lists.horde.org/archives/cvs/Week-of-Mon-20090601/087893.html
>
>
>
> Thanks,
> mike
The preference i tried to set has not been marked as shared.
Yep, the fix you mentioned
(http://lists.horde.org/archives/cvs/Week-of-Mon-20090601/087893.html)
solved my problem.
Thanks a lot,
Matthias
More information about the horde
mailing list