On Tue, Aug 9, 2011 at 17:15, Florian Mutter elm@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 record.
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 :-)
Regards, Thomas _______________________________________________ List info: http://lists.roundcube.net/dev/ BT/aba52c80