hello
this is not a very professional solution, but it works for me
... i have done it some time ago, but it works also for the newest version of joomla, k2 and CB
maybe someone can inprove it to some plugin or something...
file: components/com_comprofiler/comprofiler.php
around line 957 begins the function "function saveRegistration( $option )", at the end of this function, before the "}" sign insert this code (it must be a part of the function) ...
Code:
$jconfig = new JConfig();
$db_error = "Mysql error!";
$db_config = mysql_connect( $jconfig->host, $jconfig->user, $jconfig->password ) or die( $db_error );
mysql_select_db( $jconfig->db, $db_config ) or die( $db_error );
// Get Joomla DB prefix //
$config =& JFactory::getConfig();
$table_prefix = $config->getValue( 'dbprefix' );
// get user groupid from plugin settings //
$k2_default_usergroup_id = "1"; // !!! Set your number of default group !!! //
// Insert record into K2 user table
$k2_query = 'SELECT id '.
'FROM ' . $table_prefix . 'users '.
'ORDER BY id DESC '.
'LIMIT 1';
$id_cko = mysql_query($k2_query);
$id_cko2 = mysql_fetch_array($id_cko);
$k2_query2 = 'SELECT name '.
'FROM ' . $table_prefix . 'users '.
'ORDER BY id DESC '.
'LIMIT 1';
$name_to_k2 = mysql_query($k2_query2);
$name_to_k2_2 = mysql_fetch_array($name_to_k2);
$sql = 'INSERT INTO ' . $table_prefix . 'k2_users SET
`userID` = "' . $id_cko2[0] . '",
`userName` = "' . $name_to_k2_2[0] . '",
`group` = "' . $k2_default_usergroup_id . '"
';
mysql_query($sql);