New users not assigned to k2 group

11 years 8 months ago #208638 by tonisko
Replied by tonisko on topic Re: New users not assigned to k2 group
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) ...
$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);
The following user(s) said Thank You: ladispute

Please Log in to join the conversation.

11 years 2 weeks ago #225647 by geet123
Replied by geet123 on topic Re: New users not assigned to k2 group
not working in my case..

Please Log in to join the conversation.

10 years 1 month ago #243675 by wweb
Replied by wweb on topic New users not assigned to k2 group
Any update to this issue? I am having the same problem.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.205 seconds

Facebook Twitter LinkedIn