[horde] Can't create user with custom attributes on Horde 4 webmail
Jan Schneider
jan at horde.org
Mon Jun 18 11:34:40 UTC 2012
Zitat von OVi C <csoft2k5 at gmail.com>:
> 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
Exactly what it says. There is no such class or factory.
> 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
> --
> Horde mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: horde-unsubscribe at lists.horde.org
--
Jan Schneider
The Horde Project
http://www.horde.org/
More information about the horde
mailing list