Skip to Content Skip to Menu

[SOLVED] user assign group joomla 1.5

12 years 2 months ago - 12 years 2 months ago #193146 by richiesmall2
[SOLVED] user assign group joomla 1.5 was created by richiesmall2
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
Last edit: 12 years 2 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • nant
  • nant
  • OFFLINE
  • Posts: 25531
  • Thanks: 1830
  • Karma: 877
12 years 2 months ago #193172 by nant
Replied by nant on topic Re: user assign group joomla 1.5

richiesmall2 wrote: 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:


CB Auto-Actions plugin (incubator area) should be able to help you here without any coding needed.

Please check out tutorials also.

Please Log in or Create an account to join the conversation.

12 years 2 months ago - 12 years 2 months ago #193194 by richiesmall2
Replied by richiesmall2 on topic Re: user assign group joomla 1.5
I did a query in phpmyadmin and it worked but when i registered a new user using cb it didnt do anything, i attached a jpg going through the process. CB Auto Actions is enabled and the Query is published.

Joomla 1.5.25
CB 1.8
CB Auto Actions 2.4
Note: the plugin worked in CB 1.4 but I can't use CB Connect in that version, don't know if that information is of any use but thought i should mention it.
Attachments:
Last edit: 12 years 2 months ago by richiesmall2. Reason: Note

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 68625
  • Thanks: 9109
  • Karma: 1434
12 years 2 months ago #193288 by krileon
Replied by krileon on topic Re: user assign group joomla 1.5
Please test without using a Conditional. Please also provide the query in the auto action as I can't read it from the screenshot (too small).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

12 years 2 months ago #193309 by richiesmall2
Replied by richiesmall2 on topic Re: user assign group joomla 1.5
lol well once i turned on debug mode it made recoding the plugin alot easier :whistle: haha i got it working now sorry about that you can mark this one solved :)

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum

Facebook Twitter LinkedIn