[horde] can _prefs_hook_from_addr return an array?

Matus UHLAR - fantomas uhlar at fantomas.sk
Fri Jun 10 16:19:49 UTC 2011


> Zitat von Matus UHLAR - fantomas <uhlar at fantomas.sk>:
>> if I create _prefs_hook_from_addr, will horde (ver 3 for now) understand if
>> it returns array of allowed addresses?

On 03.06.11 09:37, lst_hoe02 at kwsoft.de wrote:
> We once solved it for SQL-Database this way for Horde3 not sure how to  
> do it in Horde4.

fine, I haven't upgraded to horde4 yet.

> horde/config/prefs.php
>
> // HACK
> global $conf;
> $account = Auth::getAuth();
> include_once 'DB.php';
> $_db = &DB::connect($conf['sql2'],true);
> $query = 'SELECT alias FROM virtual WHERE username=?';
> $sqldata=$_db->getCol($query,'alias',$account);
> foreach ($sqldata as $key => $value) {
>     $result["$value"] = $value;
> }
>
> // user preferred email address for From: line
> // If you lock this preference, you must specify a value or a hook for it in
> // horde/config/hooks.php.
> $_prefs['from_addr'] = array(
>     'value' => '',
>     'locked' => false,
>     'shared' => true,
> //    'type' => 'text',
>     'type' => 'enum',
>     'enum' => $result,
>     'desc' =>  _("Your From: address:")
> );
>
>
> I never get it to work with the hook so we hacked it in the prefs.php  
> file. With this the user can only choose from the mail addresses  
> belonging to his/her account.

This is precisely what I want to achieve. 

Defining hook and changing type to enum resulted to changing from address to
a dropdown box (good), however it was empty (bad). Even when the hook
returned an array, the default address was correctly chosen of it (good).

Calling _prefs_hook_from_addr() from prefs.php didn't help because it's
unknown there.

I hope this is easier with horde4.

And I hope the hook doesn't get called that often. It appears that it gets
called even before I log in.

-- 
Matus UHLAR - fantomas, uhlar at fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
I don't have lysdexia. The Dog wouldn't allow that.


More information about the horde mailing list