Well,
I've figured out the cause for this issue.. Havn't quite figured the fix just yet...
Both new and edit record uses the very same code, with the exception of the presence of the cids url parameter (basically tells which database record to retrieve). If this parameter is not used, '' will be used (See the CFChronoConnection class in libraries/connection.php, method editRow).
Here we create a new JTable object matching the table we're "connected" with. If cids (now called $rowid) is non-false, it will be used to load the JTable object with data from the database. If the rowid does not exist in the database, or isn't submitted, an empty object will be loaded instead.
Next, we call HTML_ChronoConnectivity::editrecord with the new JTable object, in order to display our new/edit form. This will load the needed ChronoForms data and object. Once the form is loaded, a few tweaks are done, such as setting the action url; and - this is the very important part - sets up the cf_profile plugin to prefill the form. The plugin is run, and the form is displayed.
Now, here's the issue. The Profile plugin looks for a (user controlled) url-parameter, if it's not present, a default value is used. CC set this up so that the url-parameter is called '', and the default value has the value of the cids/rowid/primary key value. The plugin is thus expected to use the default value.
However, if the default value is also empty (remember we had $rowid == '' when creating a new record), the plugin tries to be smart, and finally resorts to the current user's id. Unfortunately, this means that the plugin will load a present record with matching primary key, and submitting the form will subsequently edit the old record instead of creating a new one.
I suppose the best way of working around this, would be to not running the profile plugin in the case $rowid is empty (somewhere in the end of chronoconnectivity.html.php).
A quickfix seems to locate the "runPlugin" line of code in chronoconnectivity.html.php:
evaluate=1';
$pluginObject->params = $paramsString;
$EditFormPlugins->runPlugin('', array('ONLOAD', 'ONLOADONSUBMIT'), 'cf_profile', $pluginObject);
$EditForm->showForm(trim($MyConnection->connectionparams('front_edit_form')), JRequest::get( 'post' , JREQUEST_ALLOWRAW ), false);
and edit it accordingly:
evaluate=1';
$pluginObject->params = $paramsString;
if (!empty($row->$primary) && $row->$primary != ''){
$EditFormPlugins->runPlugin('', array('ONLOAD', 'ONLOADONSUBMIT'), 'cf_profile', $pluginObject);
}
$EditForm->showForm(trim($MyConnection->connectionparams('front_edit_form')), JRequest::get( 'post' , JREQUEST_ALLOWRAW ), false);
/Fredrik