Alright so here's the situation, To make a long story short i can't upgrade to joomla 2.5 because of sobi2 and sobipro is not flexible enough yet to even consider upgrading for right now, i have a plugin that assigned a user to a group by whatever choice they made in registration. It worked by taking the string and matching it with the user group, it doesn't work now most likely because it is outdated year 2008 and cb user group assign doesn't support 1.5, I've been going at this all day trying to recode the plugin myself but didn't get anywhere, really could use your help. here's the code, there are not helper files or anything else other than this php file. Original code:
<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$_PLUGINS->registerFunction( 'onAfterUserRegistration', 'jlsrgUserRegistration', 'plug_cb_jlsrg_regroup_class' );
/**
* Need to generate tab object to grab plugin parameters.
*/
class plug_cb_jlsrg_regroup_class extends cbTabHandler {
/**
* Construnctor
*/
function plug_cb_jlsrg_regroup_class() {
$this->cbTabHandler();
}
/**
* Get all plugin, tab, and CB fields related with this application
* @access private
* @param object mosUser reflecting the user being displayed
*/
function _awGetPlugParameters(){
$params = $this->params;
// Plugin Parameters
$PlugParams["jlsrg_enable"] = intval($params->get('jlsrg_enable', 0));
return $PlugParams;
}
function jlsrgUserRegistration($user, $success) {
global $acl, $database;
$plugparams=$this->_awGetPlugParameters();
if (!$success) return false;
if ($plugparams["jlsrg_enable"]){
$query = "SELECT cb_usertype FROM #__comprofiler WHERE user_id = " . (int) $user->id ;
$database->setQuery( $query );
$usertype = $database->loadResult();
$gid = (int) $acl->get_group_id( $usertype ,'ARO');
if ($gid && $usertype && (intval($user->id)) > 0 ){
$query = "SELECT id FROM #__core_acl_aro WHERE value = " . (int) $user->id ;
$database->setQuery( $query );
$aro_id = (int) $database->loadResult();
if ($aro_id){
$query = "UPDATE #__users SET usertype = '".$usertype."', gid = '".$gid."' WHERE id =" . (int) $user->id;
$database->setQuery($query);
$database->Query();
$query = "UPDATE #__core_acl_groups_aro_map SET group_id = " . $gid . " WHERE aro_id = " . $aro_id;
$database->setQuery( $query );
$database->query();
}
}
}
}
} // end of class plug_cb_jlsrg_regroup_class
?>
edit:typos