[imp] Problem using hooks

Jan Schneider jan at horde.org
Wed Apr 13 19:12:49 UTC 2011


Zitat von Nikolaos Milas <nmilas at noa.gr>:

> Hello,
>
> I have installed Horde Webmail 1.2.9 accessing my IMAP server  
> (Dovecot 1.2.16 with LDAP backend) and it works.
>
> However, from_addr and fullname fields are blank when composing a  
> new email (unless user defines them explicitly in preferences).
>
> So, in order to have the above fields pre-populated (to make the  
> environment more user-friendly to new users), I have tried to use  
> hooks to access our LDAP server and read mail and cn fields directly  
> and I have changed horde/config/prefs.php as follows (that is, I  
> have added: 'hook' => true,):
>
>    $_prefs['fullname'] = array(
>         'value' => '',
>         'locked' => false,
>         'shared' => true,
>         'type' => 'text',
>         'hook' => true,
>         'desc' => _("Your full name:")
>    );
>
>    $_prefs['from_addr'] = array(
>         'value' => '',
>         'locked' => false,
>         'shared' => true,
>         'type' => 'text',
>         'hook' => true,
>         'desc' =>  _("Your From: address:")
>    );
>
> and I have modified / uncommented the respective functions in  
> /config/hooks.php accordingly:
>
>    function _prefs_hook_fullname($user = null)
>    function _prefs_hook_from_addr($user = null)
>
> However, nothing changes; it seems as if hooks are not being  
> observed. I have even tried to run called functions without the @  
> prefix, to see any error logging, but I don't see any errors  
> whatsoever.
>
> I also tried to use:
>
>    $_prefs['from_addr'] = array(
>    //    'value' => '',
>         'locked' => false,
>         'shared' => true,
>         'type' => 'text',
>         'hook' => true,
>         'desc' =>  _("Your From: address:")
>    );
>
> but still nothing changed.
>
> What am I doing wrong? Do I need to do something more to enable the  
> above hooks?

Those preferences are not used directly, but their values are used  
when creating users' identities. This already happens the first time a  
user logs in. So you will only see the hooks being triggered when a  
user is logging in for the first time, or when he creates a new hook.  
Delete the "identities" preference from the backend to rebuild all  
users' identities.

Jan.

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



More information about the imp mailing list