- Posts: 4
COMMUNITY FORUM
User registration
- msp79
- Topic Author
- Offline
- New Member
Less
More
12 years 4 months ago #66356
by msp79
User registration was created by msp79
Is there any way to automatically add registered users to a k2 user group. Without using the k2 login module.
I am testing social login which creates a new user when people login to my joomla site through facebook, twiter and other social media. So it would be great if K2 just automatically added this user to a k2 user group.
I am testing social login which creates a new user when people login to my joomla site through facebook, twiter and other social media. So it would be great if K2 just automatically added this user to a k2 user group.
Please Log in or Create an account to join the conversation.
- ghog
- Offline
- New Member
Less
More
- Posts: 5
12 years 1 month ago #66357
by ghog
Replied by ghog on topic Re: User registration
this is exactly what i would like to do, were you able to find a solution?
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
12 years 1 month ago #66358
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: User registration
Hi. K2 handles this using Joomla! plugin events. So if your extension triggers the "onAfterStoreUser" event K2 should automatically add the user to a K2 group. Please let me know if that solves your issue.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Nikita Gupta
- Offline
- New Member
Less
More
- Posts: 5
11 years 11 months ago #66359
by Nikita Gupta
Replied by Nikita Gupta on topic Re: User registration
i have the exact same issue with facebook and k2 user groups.
can't figure head or tail as to what i'm suppose to do with "onAfterStoreUser" or the joomla event. Anyone care to explain in layman terms?
can't figure head or tail as to what i'm suppose to do with "onAfterStoreUser" or the joomla event. Anyone care to explain in layman terms?
Please Log in or Create an account to join the conversation.
- Walton Yang
- Offline
- New Member
Less
More
- Posts: 1
11 years 11 months ago #66360
by Walton Yang
Replied by Walton Yang on topic Re: User registration
I have the same problem on my site.
Can someone fix this?
I am using a third external login for joomla, and the new user would show up on the K2 user list, but the K2 user group is empty, other than the default group I set
Can someone fix this?
I am using a third external login for joomla, and the new user would show up on the K2 user list, but the K2 user group is empty, other than the default group I set
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
11 years 11 months ago #66361
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: User registration
@Walton Yang
K2 assigns automatically new users to a K2 group. You just need to ensure that you have selected the target group under K2 parameters.
K2 assigns automatically new users to a K2 group. You just need to ensure that you have selected the target group under K2 parameters.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Hal Szalka
- Offline
- New Member
Less
More
- Posts: 1
11 years 10 months ago #66362
by Hal Szalka
Replied by Hal Szalka on topic Re: User registration
Hi,
Same problem here.
New Joomla 2.5 installation with only K2. I created a K2 group and set to new users.
New user in the K2 user list, but K2 user group is empty.
Any idea how to fix it?
new user would show up on the K2 user list, but the K2 user group is empty
Same problem here.
New Joomla 2.5 installation with only K2. I created a K2 group and set to new users.
New user in the K2 user list, but K2 user group is empty.
Any idea how to fix it?
Please Log in or Create an account to join the conversation.
- Alexander
- Offline
- New Member
Less
More
- Posts: 1
11 years 9 months ago #66363
by Alexander
Replied by Alexander on topic Re: User registration
the same problem. need solution.
Please Log in or Create an account to join the conversation.
- Bziondik
- Offline
- New Member
Less
More
- Posts: 2
11 years 5 months ago #66364
by Bziondik
Replied by Bziondik on topic Re: User registration
There is solition joomlaforum.ru/index.php/topic,77539.msg1260323.html#msg1260323
Edit file plugins/user/k2/k2.php
function onLoginUser($user, $options)
{
$params = JComponentHelper::getParams('com_k2');
$mainframe = JFactory::getApplication();
if ($mainframe->isSite())
{
$tmp = JFactory::getUser();
$db = JFactory::getDBO();
$db->setQuery("SELECT id FROM #__users WHERE username = ".$db->Quote($user));
$id = $db->loadResult();
$db->setQuery("SELECT username FROM #__users WHERE username = ".$db->Quote($user));
$mytempusername = $db->loadResult();
if ($id)
{
$k2id = $this->getK2UserID($id);
}
else
{
$k2id = false;
}
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'tables');
$row = JTable::getInstance('K2User', 'Table');
if ($k2id)
{
$row->load($k2id);
}
else
{
$row->set('userID', $id);
$row->set('userName', $mytempusername);
$row->set('group', $params->get('K2UserGroup', 1));
}
$row->ip = $_SERVER;
$row->hostname = gethostbyaddr($_SERVER);
$row->store();
if ($params->get('cookieDomain') && $id)
{
setcookie("userID", $id, 0, '/', $params->get('cookieDomain'), 0);
}
}
return true;
}
Edit file plugins/user/k2/k2.php
function onLoginUser($user, $options)
{
$params = JComponentHelper::getParams('com_k2');
$mainframe = JFactory::getApplication();
if ($mainframe->isSite())
{
$tmp = JFactory::getUser();
$db = JFactory::getDBO();
$db->setQuery("SELECT id FROM #__users WHERE username = ".$db->Quote($user));
$id = $db->loadResult();
$db->setQuery("SELECT username FROM #__users WHERE username = ".$db->Quote($user));
$mytempusername = $db->loadResult();
if ($id)
{
$k2id = $this->getK2UserID($id);
}
else
{
$k2id = false;
}
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'tables');
$row = JTable::getInstance('K2User', 'Table');
if ($k2id)
{
$row->load($k2id);
}
else
{
$row->set('userID', $id);
$row->set('userName', $mytempusername);
$row->set('group', $params->get('K2UserGroup', 1));
}
$row->ip = $_SERVER;
$row->hostname = gethostbyaddr($_SERVER);
$row->store();
if ($params->get('cookieDomain') && $id)
{
setcookie("userID", $id, 0, '/', $params->get('cookieDomain'), 0);
}
}
return true;
}
Please Log in or Create an account to join the conversation.