I am using Chronoforms to create a custom registration page. How can we add a function or plugin to now add the user to a specific JUGA group?
Thanks
Thanks
Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.
Thank you for your support!
$username = ($_POST['username']); $user_id = JFactory::getUser($username)->get('id');
<?php $database = &JFactory::getDBO(); $username = ($_POST['username']); $jugagroup_id = 4; $user_id = JFactory::getUser($username)->get('id'); // query the db to see if the user is already a member of group $database->setQuery("SELECT `user_id` FROM #__juga_u2g " ." WHERE `group_id` = '$jugagroup_id'" ." AND `user_id` = '$user_id' "); $already = $database->loadResult(); // if they aren't already a member of the group, add them to the group if (($already != $user_id)) { $query = "INSERT INTO #__juga_u2g " ."\n SET `user_id` = '$user_id'," ."\n `group_id` = '$jugagroup_id'"; $database->setQuery( $query ); if (!$database->query()) { echo $database->getErrorMsg(); } } ?>
2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com