[RCD] SMTP settings override via Identities plugin

Thomas Bruederli thomas at roundcube.net
Fri Aug 12 21:05:17 CEST 2011

On Tue, Aug 9, 2011 at 17:15, Florian Mutter <elm at skweez.net> wrote:
> I would like to write a plugin that enables the user to specify an external
> SMTP server for every identity. But there are some questions I got.
> I startet and used the identity_form hook to inject the additional form
> elements, but how am I supposed to get the values that were entered by the
> user? identity_update and identity_create do not provide the additional
> data to my plugin. And of course the data is not saved automatically.

To get the submitted data simply use $_POST['myvar'] or better
get_input_value('myvar', RCUBE_INPUT_POST);
> Second question: When I get the data, how is a plugin supposed to save
> data? Do I save the data with:
> rcmail::get_instance()->user->save_prefs(array('key' => $value));
> or is there a way to save the data right where the identity is saved?

This is up to the plugin developer... either you use user prefs or you
extend the identities database table. With the latter option you can
copy the submitted data right into the 'record' property of the
'identity_update' hook and they'll be stored with the identities

Since Roundcube doesn't (yet) provide an install routine or script for
plugins, you have to mention the schema changes in a README file and
hope that people read it :-)

List info: http://lists.roundcube.net/dev/

More information about the Dev mailing list