Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: Hakke on March 29, 2014, 12:12:11 PM

Title: Using virtuser_query with two databases
Post by: Hakke on March 29, 2014, 12:12:11 PM
Hello,

i want to use the virtuser_query to fill the identity settings on first login of a user.

The standard-configuration of the plugin is:
$rcmail_config['virtuser_query'] = "SELECT email_address FROM database.table WHERE login = '%u'";

With this configuration setting i can set the field email in RC identies table..

Now: I also want to fill in the field name from a defined second database..

Can somebody help?
Title: Re: Using virtuser_query with two databases
Post by: Hakke on March 29, 2014, 03:58:18 PM
I tried something like that:

SELECT address, name FROM system.virtuser, system.names WHERE virtuser.virtuser = names.username AND virtuser = '%u'

In phpmyadmin the result works fine...

First column: Mailadress
Second column: Name

The following colums are empty so that i get the following error message:
DB Error: [1048] Column 'organization' cannot be null (SQL Query: INSERT INTO identities (changed, `email`, `name`, `organization`, `reply-to`, `bcc`, `signature`, `html_signature`, `standard`, user_id) VALUES (now(), '[email protected]', 'Hakke', NULL, NULL, NULL, NULL, '0', '1', '6610')) in /var/www/roundcube/roundcube-0.95/program/lib/Roundcube/rcube_db.php on line 416 (POST /?_task=login&_action=login)

How do i have to change my sql-query so that it is working? I dont want to fill organization, reply to etc...
Title: Re: Using virtuser_query with two databases
Post by: alec on March 30, 2014, 04:18:29 AM
I think this should be fixed in Roundcube, but you can do:

SELECT address, name, '', '', '', '', '' FROM ...
Title: Re: Using virtuser_query with two databases
Post by: Hakke on March 30, 2014, 04:45:16 AM
Thanks Alec!

This workaround works fine for me :-)

Should i make a record in your trac to fix this?
Title: Re: Using virtuser_query with two databases
Post by: alec on March 30, 2014, 05:22:30 AM
Fixed in https://github.com/roundcube/roundcubemail/commit/8c783c0d66e9b7e2c27fce7beee2c07594bae3c4