[horde] can _prefs_hook_from_addr return an array?

lst_hoe02 at kwsoft.de lst_hoe02 at kwsoft.de
Mon Jun 13 19:31:39 UTC 2011


Zitat von Matus UHLAR - fantomas <uhlar at fantomas.sk>:

>> 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).

As far as i remember this was exactly the problem why we don't use a  
hook. I have never get the dropdown-box filled with a array.
With the above in the prefs.php file all work as expected so the user  
could only choose from the addresses tied to them as alias in the  
database. Sadly there is nothing out-of-the-box and let the user type  
in every address they like is not a option at all.


> 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.

As far as i know it get called once at login and the results are  
stored in the use session.

Regards

Andreas


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6046 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.horde.org/archives/horde/attachments/20110613/ca73abd3/attachment.bin>


More information about the horde mailing list