[horde] Can't create user with custom attributes on Horde 4 webmail

OVi C csoft2k5 at gmail.com
Sun Jun 17 15:49:52 UTC 2012


Hi.
I've have enabled the folowing hook from hooks.php file trying to add some
custom attributes for turba when an user gets created:

    public function signup_getextra()
    {
        return Horde::loadConfiguration('attributes.local.php',
'attributes', 'turba');
     }


    public function signup_addextra($userId, $extra)
    {

        $db = $GLOBALS['injector']->getInstance('Horde_Db_Pear')->getDb();

        $fields = $values = array();
        foreach ($extra as $field => $value) {
            $fields[] = 'object_' . Horde_String::lower($field);
            $values[] = $db->quote(Horde_String::convertCharset($value,
'UTF-8', $GLOBALS['conf']['sql']['charset']));
        }
        $fields[] = 'object_id';
        $values[] = $db->quote($userId);

        $query  = 'INSERT INTO turba_objects ( owner_id, ' . implode(', ',
$fields) . ')';
        $query .= ' VALUES ( \'admin\', ' . implode(', ', $values) . ')';
        $result = $db->query($query);

        if ($result instanceof PEAR_Error) {
            throw new Horde_Exception_Wrapped($result);
        }
    }

but it doesn't work.

It throws the following error:
A fatal error has occurredClass Horde_Db_Pear does not exist

1. Horde::callHook() /var/www/webmail/admin/user.php:95
2. call_user_func_array() /usr/share/pear/Horde.php:1827
3. Horde_Hooks->signup_addextra()
4. Horde_Injector->getInstance() /var/www/webmail/config/hooks.php:636
5. Horde_Injector->createInstance() /usr/share/pear/Horde/Injector.php:248
6. Horde_Injector_Binder_AnnotatedSetters->create()
/usr/share/pear/Horde/Injector.php:213
7. Horde_Injector_Binder_Implementation->create()
/usr/share/pear/Horde/Injector/Binder/AnnotatedSetters.php:69
8. ReflectionClass->__construct()
/usr/share/pear/Horde/Injector/Binder/Implementation.php:60


More information about the horde mailing list