[dev] IMP: [patch] imp/lib/Identity/imp/php

Jan Schneider jan at horde.org
Wed Jul 16 16:07:53 PDT 2003


Zitat von Marc Jauvin <marc at register4less.com>:

> Jan Schneider <jan at horde.org> wrote:
>
> > Zitat von Marc Jauvin <marc at register4less.com>:
> >
> > > This patch allow a hook to be used when there is no "from address"
> > > defined (no
> > > default identity created yet).
> >
> > You can already use a pref hook for the from_addr preference that will
> do
> > the same.
>
> This is either broken or has been removed from the code. Can you verify
> that
> this works for you (and if so, let me know how to activate)?
>
> The patch I provided allow for the Compose Window to set the "From:"
> field to a
> custom value if no Identity has been created).

This is how they look in one of my installs. It's not that up-to-date, but I
can't remember anything been changed lately that might have broken this:

if (!function_exists('_prefs_hook_from_addr')) {
    function _prefs_hook_from_addr($username = null)
    {
        $user = _get_user($username);
        if (is_array($user)) {
            return $user['EMAIL'];
        }
    }
}

if (!function_exists('_prefs_hook_fullname')) {
    function _prefs_hook_fullname ($username = null)
    {
//echo "<pre>hook\n";
        $user = _get_user($username);
//var_dump($user);
        if (is_array($user)) {
            return $user['NAME2'] . ' ' . $user['NAME1'];
        }
    }
}


Don't forget to activate the hooks in config/prefs.php:

// user full name for From: line
$_prefs['fullname'] = array(
    'value' => '',
    'locked' => false,
    'shared' => true,
    'hook' => true,
    'type' => 'implicit');

// user preferred email address for From: line
$_prefs['from_addr'] = array(
    'value' => '',
    'locked' => false,
    'shared' => true,
    'hook' => true,
    'type' => 'implicit');


Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - discover your knowledge
http://www.tip4all.de - Deine private Tippgemeinschaft


More information about the dev mailing list