joomla user registered through CB is not assigned to k2 user group

699 Views Asked by At

In one of my joomla 2.5 site i am using community builder registration form.When registration completed by user who clicked confirmation link in email, the user is not assigned to k2 user group.

I set that k2 user group in k2
parameters->advanced setting->Select the default K2 User Group for new registrations
dropdown so that new registered user will be assigned to that group.

But it's not working.I have all required plugins enabled while i was searching through google.com for solution

Any solutions and suggestions from experts are welcome.

2

There are 2 best solutions below

0
pkExec On

I came across this when searching for a similar problem: gavick's facebook login didn't assign k2 usergroup. I suspect the solution is the same.

Edit: /plugins/users/k2/k2.php

replace in function "onLoginUser":


// Get the user id
            $db = JFactory::getDBO();
            $db->setQuery("SELECT id FROM #__users WHERE username = ".$db->Quote($user['username']));
            $id = $db->loadResult();

with:


// Get the user id
            $db = JFactory::getDBO();
            $db->setQuery("SELECT id FROM #__users WHERE username = ".$db->Quote($user['username']));
            $id = $db->loadResult();

            $db->setQuery("SELECT username FROM #__users WHERE username = ".$db->Quote($user['username']));
            $mytempusername = $db->loadResult();

And replace:


$row->set('userID', $id);
$row->set('userName', $mytempusername);
$row->set('group', $params->get('K2UserGroup', 1));

with:


$row->set('userID', $id);
//$row->set('userName', $user['fullname']);
$row->set('userName', $mytempusername);
$row->set('group', $params->get('K2UserGroup', 1));
0
Lissa On

work perfect only the right code for remplace in k2 2.6.6 is

$row->set('userID', $tmp->id);
$row->set('userName', $tmp->name);
$row->set('group', $params->get('K2UserGroup', 1));