[imp] question

Eric Rostetter eric.rostetter@physics.utexas.edu
Tue Nov 26 00:02:11 2002


Quoting Jason crib <jkl3100@yahoo.com>:

> Does somebody know how to add a prefix "a" in all username. For example:

This is the kind of thing that the  "hooks" are designed to solve.

Specifically see the imp_get_vinfo hook set via the $conf['hooks']['vinfo']
and dummy them down for your use.  Something like:

$conf['hooks']['vinfo'] = 'imp_get_vinfo';

if (!function_exists('imp_get_vinfo')) {
    function imp_get_vinfo ($type = 'username') {
        global $conf, $imp;

        $vdomain = getenv('HTTP_HOST');
        $vdomain = preg_replace('|^mail\.|i', '', $vdomain);
        $vdomain = strtolower($vdomain);

        if ($type == 'username') {
            return 'a' . $imp['user'];
        } elseif ($type == "vdomain") {
            return $vdomain;
        } else {
            return new PEAR_Error('invalid type: ' . $type);
        }
}

Now I doubt that code will work for you as-is, but it should give you
a place to start.

-- 
Eric Rostetter
The Department of Physics
The University of Texas at Austin

Why get even? Get odd!


More information about the imp mailing list