Roundcube Community Forum

 

Using virtuser_query with two databases

Started by Hakke, March 29, 2014, 12:12:11 PM

Previous topic - Next topic

Hakke

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?

Hakke

#1
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...

alec

I think this should be fixed in Roundcube, but you can do:

SELECT address, name, '', '', '', '', '' FROM ...

Hakke

Thanks Alec!

This workaround works fine for me :-)

Should i make a record in your trac to fix this?