Hello,
as I am not a joomla programmer, I am a little bit lost.
I created a cronoform wich is linked to the Joomla registration plugin.
Everything wents fine.CF is perfect and I just ordered some licneces.
My problem: I like to "update" the usertype of the newly created user to "Author". I think this could be done in the custom php-code after the registraion.
Is there a way to get the ID of the newly created User and upgrade it in the DB?
I think there must be some joomla classes for that?
It would be great if someone could help me with a short PHP example or point me in the right direction.
Matti
				
				
				
			as I am not a joomla programmer, I am a little bit lost.
I created a cronoform wich is linked to the Joomla registration plugin.
Everything wents fine.CF is perfect and I just ordered some licneces.
My problem: I like to "update" the usertype of the newly created user to "Author". I think this could be done in the custom php-code after the registraion.
Is there a way to get the ID of the newly created User and upgrade it in the DB?
I think there must be some joomla classes for that?
It would be great if someone could help me with a short PHP example or point me in the right direction.
Matti
					Hi matti,
The user id is available in the User object immediately after the registration. I think you can then use $user->type = ?? and $user->save() to amend it - but that needs testing.
Bob
				
				
				
			The user id is available in the User object immediately after the registration. I think you can then use $user->type = ?? and $user->save() to amend it - but that needs testing.
Bob
					Perfect!
this lines:
<?php
$user->usertype = "Author";
$user->gid=19;
$user->save();
?>
in the "Extra after Registration code" solves my problem and updates the user to "Author"
				
				
				
			this lines:
<?php
$user->usertype = "Author";
$user->gid=19;
$user->save();
?>
in the "Extra after Registration code" solves my problem and updates the user to "Author"
					I'm trying to do this same thing except using the cb_registration plugin but it is not working. Does anyone know if the code needs to be different to work with the CB plugin or if it has to be done a different way?
				
				
				
				
			
					Hi zandergraphics,
As far as I know CB uses the same Joomla table for Joomla Group settings but CB may have other Groups that need different settings.
Bob
				
				
				
			As far as I know CB uses the same Joomla table for Joomla Group settings but CB may have other Groups that need different settings.
Bob
					Hi zandergraphics & Bob,
From what I can tell of the source for the cb_registration plugin, the "Extra after onsubmit code" is not implemented, only the "Extra before onsubmit code". As such, you'll have to use the normal on-submit code in your form setup, you'll have to retrieve the JUser object of the new user from the $MyPlugins object:
/Fredrik
				
				
				
			From what I can tell of the source for the cb_registration plugin, the "Extra after onsubmit code" is not implemented, only the "Extra before onsubmit code". As such, you'll have to use the normal on-submit code in your form setup, you'll have to retrieve the JUser object of the new user from the $MyPlugins object:
<?
$user =& $MyPlugins->cf_cb_registration['user'];
$user->set('gid', 19);
$user->save();
?>/Fredrik
					Using the code above, I'm getting:
I'm doing some searching on this right now but thought I'd post back in case someone more familiar than myself might know the reason.
Thanks for your help guys. I must say I've been really impressed with Chronoforms and everything it can do. I was using another component before and quite often seemed to just get back a generic "it can't do that" from support. So, thank you for being so helpful.
				
				
				
			Fatal error: Call to a member function set() on a non-object in /home/myaccount/public_html/2009/components/com_chronocontact/libraries/customcode.php(51) : eval()'d code on line 3I'm doing some searching on this right now but thought I'd post back in case someone more familiar than myself might know the reason.
Thanks for your help guys. I must say I've been really impressed with Chronoforms and everything it can do. I was using another component before and quite often seemed to just get back a generic "it can't do that" from support. So, thank you for being so helpful.
					Hi zandergraphics,
Could you try this then:
/Fredrik
				
				
				
			Could you try this then:
<?
$MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id);
$user =& $MyPlugins->cf_cb_registration['user'];
$user->set('gid', 19);
$user->save();
?>/Fredrik
					Still the same... this time:
				
				
				
			Fatal error: Call to a member function set() on a non-object in /home/myaccount/public_html/2009/components/com_chronocontact/libraries/customcode.php(51) : eval()'d code on line 4
					That is odd,
Would you mind adding some debug-code?
That should show the actual contents of the $MyForm and $MyPlugins objects, which should help.
/Fredrik
				
				
				
			Would you mind adding some debug-code?
<?
$MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id);
echo "<pre>";
print_r($MyForm);
print_r($MyPlugins);
echo "</pre>";
?>That should show the actual contents of the $MyForm and $MyPlugins objects, which should help.
/Fredrik
					Here's the result, hopefully it will post to the forum in a readable format...
				
				
				
			CFChronoForm Object
(
    [formrow] => stdClass Object
        (
            [id] => 4
            [name] => register2
            [html] => 
First Name
 
Last Name
 
    
    setQuery($sql);
$rows = $database->loadObjectList();
foreach ($rows as $row) {
  $selectOptions .= "fieldtitle\">$row->fieldtitle";
}
?>
Hospital
 
Email
 
Username
 
Password
 
Confirm Password
 
setQuery($sql);
$row = $database->loadObject();
$hosp_address = $row->address;
?>
Image Verification {imageverification}
 
 
            [scriptcode] => 
            [stylecode] => 
            [redirecturl] => 
            [emailresults] => 2
            [fieldsnames] => firstname,lastname,email,username,password,password2,user_id,name,membership_id,id,published,currency,cb_address,cb_hospital
            [fieldstypes] => text,text,text,text,password,password,hidden,hidden,hidden,hidden,hidden,hidden,hidden,select
            [onsubmitcode] => formrow->id);
echo "
";
print_r($MyForm);
print_r($MyPlugins);
echo "
";
?>
            [onsubmitcodeb4] => setQuery($sql);
$result = $database->loadObject();
$_POST['cb_address'] = "$row->address";
?>
            [server_validation] => 
            [attformtag] => 
            [submiturl] => 
            [emailtemplate] => 
            [useremailtemplate] => 
            [paramsall] => formmethod=post
LoadFiles=Yes
submissions_limit=
submissions_limit_error=Sorry but you can not submit the form again very soon like this!
handlepostedarrays=Yes
debug=0
checkToken=1
mysql_type=1
enmambots=No
captcha_dataload=1
captcha_dataload_skip=
useCurrent=1
datefieldformat=d/m/Y
datefieldsnames=
datefieldextras=classes: ['dashboard']
dbconnection=Yes
savedataorder=after_email
dvfields=
dvrecord=Record #n
uploads=No
uploadfields=
uploadpath=/home/nnpnet/public_html/2009/components/com_chronocontact/uploads/register/
filename_format=$filename = date('YmdHis').'_'.$chronofile['name'];
upload_exceedslimit=Sorry, Your uploaded file size exceeds the allowed limit.
upload_lesslimit=Sorry, Your uploaded file size is less than the allowed limit
upload_notallowed=Sorry, Your uploaded file type is not allowed
imagever=Yes
imtype=1
imgver_error_msg=You have entered an incorrect verification code at the bottom of the form.
validate=Yes
validatetype=mootools
validate_onlyOnBlur=1
validate_wait=
validate_onlyOnSubmit=0
validation_type=default
val_required=
val_validate_number=
val_validate_digits=
val_validate_alpha=
val_validate_alphanum=
val_validate_date=
val_validate_email=
val_validate_url=
val_validate_date_au=
val_validate_currency_dollar=
val_validate_selection=
val_validate_one_required=
val_validate_confirmation=
servervalidate=Yes
autogenerated_order=3
onsubmitcode_order=2
plugins_order=1
plugins=cf_cb_registration
mplugins_order=3
tablenames=jos_rsmembership_membership_users,jos_users
            [titlesall] => 
            [extravalrules] => 
            [dbclasses] => 
            [autogenerated] => formparams("dbconnection") == "Yes"){
			$user = JFactory::getUser();			
			$row =& JTable::getInstance("rsmembership_membership_users", "Table");
			srand((double)microtime()*10000);
			$inum	=	"I" . substr(base64_encode(md5(rand())), 0, 16).md5(uniqid(mt_rand(), true));
			JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
			JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
			JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
			JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
			$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );			
			if (!$row->bind( $post )) {
				JError::raiseWarning(100, $row->getError());
			}				
			if (!$row->store()) {
				JError::raiseWarning(100, $row->getError());
			}
			$MyForm->tablerow["jos_rsmembership_membership_users"] = $row;
		}
		?>
		formparams("dbconnection") == "Yes"){
			$user = JFactory::getUser();			
			$row =& JTable::getInstance("users", "Table");
			srand((double)microtime()*10000);
			$inum	=	"I" . substr(base64_encode(md5(rand())), 0, 16).md5(uniqid(mt_rand(), true));
			JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
			JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
			JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
			JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
			$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );			
			if (!$row->bind( $post )) {
				JError::raiseWarning(100, $row->getError());
			}				
			if (!$row->store()) {
				JError::raiseWarning(100, $row->getError());
			}
			$MyForm->tablerow["jos_users"] = $row;
		}
		?>
		
            [chronocode] => [type="cf_textbox"CHRONO_CONSTANT_EOL{CHRONO_CONSTANT_EOLid = text_0CHRONO_CONSTANT_EOLname = nameCHRONO_CONSTANT_EOLclass = cf_inputbox requiredCHRONO_CONSTANT_EOLtype = textCHRONO_CONSTANT_EOLsize = 30CHRONO_CONSTANT_EOLmaxlength = 150CHRONO_CONSTANT_EOLtitle = CHRONO_CONSTANT_EOLhidelabel = 0CHRONO_CONSTANT_EOLlabelwidth = 150pxCHRONO_CONSTANT_EOLlabeltext = NameCHRONO_CONSTANT_EOLtooltiptext = CHRONO_CONSTANT_EOLslabel = CHRONO_CONSTANT_EOL}]CHRONO_CONSTANT_EOL[type="cf_dropdown"CHRONO_CONSTANT_EOL{CHRONO_CONSTANT_EOLid = select_7CHRONO_CONSTANT_EOLname = hospitalCHRONO_CONSTANT_EOLclass = cf_inputbox validate-selectionCHRONO_CONSTANT_EOLsize = 1CHRONO_CONSTANT_EOLtitle = CHRONO_CONSTANT_EOLfirstoption = 1CHRONO_CONSTANT_EOLfirstoptiontext = Choose Your HospitalCHRONO_CONSTANT_EOLtheoptions = Guest Access*,*Alaska Native Medical Center, Anchorage, AK*,*Allen Hospital, Waterloo, IA*,*Barnes Jewish Hospital, St. Louis, MO*,*Battle Creek Health System, Battle Creek, MI*,*Children's Hospital of Birmingham, Birmingham, AL*,*Corporate Office for Trinity Health System, Novi, MI*,*Covenant Health System, Waterloo, IA*,*Genesis Medical Center, Davenport, IA*,*Grinnell Regional Medical Center, Grinnell, IA*,*Henry Ford Macomb Hospitals, Clinton Township, MI*,*Holy Cross Hospital, Silver Springs, MD*,*Jennie Edmundson Memorial Hospital, Council Bluffs, IA*,*Mary Greeley Medical Center, Ames, IA*,*Mercy Medical Center, Des Moines, IA*,*Mercy General Health Partners, Muskegon, MI*,*Mercy Hospital, Cadillac, MI*,*Mercy Hospital, Grayling, MI*,*Mercy Hospital, Port Huron, MI*,*Mercy Medical Center, Clinton, IA*,*Mercy Medical Center, Dubuque, IA*,*Mercy Medical Center-North Iowa, Mason City, IA*,*Mercy Medical Center, Sioux City, IA*,*Mount Carmel Health System-East, Columbus, OH*,*Mount Carmel Health System-West, Columbus, OH*,*Mount Carmel Health System-St. Ann's Hospital, Westerville, OH*,*Mount Carmel Health System-New Albany, New Albany, OH*,*Munson Medical Center, Traverse City, MI*,*St. Agnes Medical Center, Fresno, CA*,*St. Alphonsus Regional Medical Center, Boise, ID*,*St. Cloud Hospital, St. Cloud, MN*,*St. Joseph's Hospital, Brainerd, MN*,*St. Joseph Mercy Hospital, Ann Arbor, MI*,*St. Joseph Mercy Oakland, Pontiac, MI*,*St. Joseph Regional Medical Center, Mishawaka, IN*,*St. Joseph Regional Medical Center, Plymouth, IN*,*St. Joseph Regional Medical Center, South Bend, IN*,*St. Louis University Hospital, St. Louis, MO*,*St. Luke's Health System, Boise, ID*,*St. Luke's Health System, Meridian, ID*,*St. Luke's Health System - Magic Valley, Twin Falls, ID*,*St. Luke's Health System - Wood River, Ketchum, ID*,*St. Mary's Healthcare, Grand Rapids, MI*,*St. Mary Mercy Hospital, Livonia, MI*,*Sanford Health, Sioux Falls, SD*,*Sparrow Hospital - Lansing, MI*,*SW Vermont Health Care, Bennington, VT*,*Trinity Medical Center, Rock Island, IL*,*Unity Healthcare, Muscatine, IA*,*University of Iowa Hospitals & Clinics, Iowa City, IA*,*University of Kentucky Chandler Medical Center, Lexington, KY*,*University of Michigan Health System, Ann Arbor, MI*,*VA Black Hills Health Care System, Fort Meade, SD*,*VA Caribbean Healthcare System, San Juan, Puerto Rico*,*VA Central Arkansas Healthcare System, Little Rock, AR*,*VA Central Iowa Health Care System, Des Moines, IA*,*VA Iowa City Health Care System, Iowa City, IA*,*VA James A. Haley Hospital, Tampa, FL*,*VA Jesse Brown Medical Center, Chicago, IL*,*VA John D. Dingell Medical Center, Detroit, MI*,*VA Medical Center, Atlanta, GA*,*VA Medical Center, Durham, NC*,*VA Medical Center, Fargo, ND*,*VA Medical Center, Lebanon, PA*,*VA Medical Center, Pittsburgh, PA*,*VA Medical Center, Providence, RI*,*VA Medical Center, Sioux Falls, SD*,*VA Minneapolis Medical Center, Minneapolis, MN*,*VA Nebraska-Western Iowa Health Care System, Omaha, NE*,*VA Overton Brooks Medical Center, Shreveport, LA*,*VA Richard L. Roudebash Medical Center, Indianapolis, IN*,*VA St. Cloud Medical Center, St. Cloud, MN*,*VA South Texas Healthcare System, San Antonio, TX*,*VA William S. Middleton Memorial Hospital, Madison, WI*,*CHRONO_CONSTANT_EOLhidelabel = 0CHRONO_CONSTANT_EOLlabelwidth = 150pxCHRONO_CONSTANT_EOLlabeltext = HospitalCHRONO_CONSTANT_EOLtooltiptext = CHRONO_CONSTANT_EOLslabel = CHRONO_CONSTANT_EOL}]CHRONO_CONSTANT_EOL[type="cf_textbox"CHRONO_CONSTANT_EOL{CHRONO_CONSTANT_EOLid = text_1CHRONO_CONSTANT_EOLname = usernameCHRONO_CONSTANT_EOLclass = cf_inputbox requiredCHRONO_CONSTANT_EOLtype = textCHRONO_CONSTANT_EOLsize = 30CHRONO_CONSTANT_EOLmaxlength = 150CHRONO_CONSTANT_EOLtitle = CHRONO_CONSTANT_EOLhidelabel = 0CHRONO_CONSTANT_EOLlabelwidth = 150pxCHRONO_CONSTANT_EOLlabeltext = UsernameCHRONO_CONSTANT_EOLtooltiptext = CHRONO_CONSTANT_EOLslabel = CHRONO_CONSTANT_EOL}]CHRONO_CONSTANT_EOL[type="cf_textbox"CHRONO_CONSTANT_EOL{CHRONO_CONSTANT_EOLid = text_2CHRONO_CONSTANT_EOLname = emailCHRONO_CONSTANT_EOLclass = cf_inputbox required validate-emailCHRONO_CONSTANT_EOLtype = textCHRONO_CONSTANT_EOLsize = 30CHRONO_CONSTANT_EOLmaxlength = 150CHRONO_CONSTANT_EOLtitle = CHRONO_CONSTANT_EOLhidelabel = 0CHRONO_CONSTANT_EOLlabelwidth = 150pxCHRONO_CONSTANT_EOLlabeltext = EmailCHRONO_CONSTANT_EOLtooltiptext = CHRONO_CONSTANT_EOLslabel = CHRONO_CONSTANT_EOL}]CHRONO_CONSTANT_EOL[type="cf_password"CHRONO_CONSTANT_EOL{CHRONO_CONSTANT_EOLid = text_3CHRONO_CONSTANT_EOLname = passwordCHRONO_CONSTANT_EOLclass = cf_inputbox requiredCHRONO_CONSTANT_EOLtype = passwordCHRONO_CONSTANT_EOLsize = 30CHRONO_CONSTANT_EOLmaxlength = 150CHRONO_CONSTANT_EOLtitle = CHRONO_CONSTANT_EOLhidelabel = 0CHRONO_CONSTANT_EOLlabelwidth = 150pxCHRONO_CONSTANT_EOLlabeltext = PasswordCHRONO_CONSTANT_EOLtooltiptext = CHRONO_CONSTANT_EOLslabel = CHRONO_CONSTANT_EOL}]CHRONO_CONSTANT_EOL[type="cf_password"CHRONO_CONSTANT_EOL{CHRONO_CONSTANT_EOLid = text_4CHRONO_CONSTANT_EOLname = password2CHRONO_CONSTANT_EOLclass = cf_inputbox requiredCHRONO_CONSTANT_EOLtype = passwordCHRONO_CONSTANT_EOLsize = 30CHRONO_CONSTANT_EOLmaxlength = 150CHRONO_CONSTANT_EOLtitle = CHRONO_CONSTANT_EOLhidelabel = 0CHRONO_CONSTANT_EOLlabelwidth = 150pxCHRONO_CONSTANT_EOLlabeltext = Confirm PasswordCHRONO_CONSTANT_EOLtooltiptext = CHRONO_CONSTANT_EOLslabel = CHRONO_CONSTANT_EOL}]CHRONO_CONSTANT_EOL[type="cf_hidden"CHRONO_CONSTANT_EOL{CHRONO_CONSTANT_EOLid = hidden_8CHRONO_CONSTANT_EOLname = cidCHRONO_CONSTANT_EOLvalue = 1CHRONO_CONSTANT_EOLhidelabel = 0CHRONO_CONSTANT_EOLlabelwidth = 0CHRONO_CONSTANT_EOLtooltiptext = CHRONO_CONSTANT_EOLslabel = CHRONO_CONSTANT_EOL}]CHRONO_CONSTANT_EOL[type="cf_captcha"CHRONO_CONSTANT_EOL{CHRONO_CONSTANT_EOLhidelabel = 0CHRONO_CONSTANT_EOLlabelwidth = 150pxCHRONO_CONSTANT_EOLlabeltext = Image VerificationCHRONO_CONSTANT_EOLtooltiptext = CHRONO_CONSTANT_EOL}]CHRONO_CONSTANT_EOL[type="cf_button"CHRONO_CONSTANT_EOL{CHRONO_CONSTANT_EOLvalue = RegisterCHRONO_CONSTANT_EOLname = button_7CHRONO_CONSTANT_EOLtooltiptext = CHRONO_CONSTANT_EOLreset = 1CHRONO_CONSTANT_EOLhidelabel = 0CHRONO_CONSTANT_EOLlabelwidth = 0CHRONO_CONSTANT_EOL}]CHRONO_CONSTANT_EOL
            [theme] => default
            [published] => 1
            [extra1] => 
            [extra2] => 
            [extra3] => 
            [extra4] => 
            [extra5] => 
        )
    [formparams] => JParameter Object
        (
            [_raw] => formmethod=post
LoadFiles=Yes
submissions_limit=
submissions_limit_error=Sorry but you can not submit the form again very soon like this!
handlepostedarrays=Yes
debug=0
checkToken=1
mysql_type=1
enmambots=No
captcha_dataload=1
captcha_dataload_skip=
useCurrent=1
datefieldformat=d/m/Y
datefieldsnames=
datefieldextras=classes: ['dashboard']
dbconnection=Yes
savedataorder=after_email
dvfields=
dvrecord=Record #n
uploads=No
uploadfields=
uploadpath=/home/nnpnet/public_html/2009/components/com_chronocontact/uploads/register/
filename_format=$filename = date('YmdHis').'_'.$chronofile['name'];
upload_exceedslimit=Sorry, Your uploaded file size exceeds the allowed limit.
upload_lesslimit=Sorry, Your uploaded file size is less than the allowed limit
upload_notallowed=Sorry, Your uploaded file type is not allowed
imagever=Yes
imtype=1
imgver_error_msg=You have entered an incorrect verification code at the bottom of the form.
validate=Yes
validatetype=mootools
validate_onlyOnBlur=1
validate_wait=
validate_onlyOnSubmit=0
validation_type=default
val_required=
val_validate_number=
val_validate_digits=
val_validate_alpha=
val_validate_alphanum=
val_validate_date=
val_validate_email=
val_validate_url=
val_validate_date_au=
val_validate_currency_dollar=
val_validate_selection=
val_validate_one_required=
val_validate_confirmation=
servervalidate=Yes
autogenerated_order=3
onsubmitcode_order=2
plugins_order=1
plugins=cf_cb_registration
mplugins_order=3
tablenames=jos_rsmembership_membership_users,jos_users
            [_xml] => 
            [_elements] => Array
                (
                )
            [_elementPath] => Array
                (
                    [0] => /home/nnpnet/public_html/2009/libraries/joomla/html/parameter/element
                )
            [_defaultNameSpace] => _default
            [_registry] => Array
                (
                    [_default] => Array
                        (
                            [data] => stdClass Object
                                (
                                    [formmethod] => post
                                    [LoadFiles] => Yes
                                    [submissions_limit] => 
                                    [submissions_limit_error] => Sorry but you can not submit the form again very soon like this!
                                    [handlepostedarrays] => Yes
                                    [debug] => 0
                                    [checkToken] => 1
                                    [mysql_type] => 1
                                    [enmambots] => No
                                    [captcha_dataload] => 1
                                    [captcha_dataload_skip] => 
                                    [useCurrent] => 1
                                    [datefieldformat] => d/m/Y
                                    [datefieldsnames] => 
                                    [datefieldextras] => classes: ['dashboard']
                                    [dbconnection] => Yes
                                    [savedataorder] => after_email
                                    [dvfields] => 
                                    [dvrecord] => Record #n
                                    [uploads] => No
                                    [uploadfields] => 
                                    [uploadpath] => /home/nnpnet/public_html/2009/components/com_chronocontact/uploads/register/
                                    [filename_format] => $filename = date('YmdHis').'_'.$chronofile['name'];
                                    [upload_exceedslimit] => Sorry, Your uploaded file size exceeds the allowed limit.
                                    [upload_lesslimit] => Sorry, Your uploaded file size is less than the allowed limit
                                    [upload_notallowed] => Sorry, Your uploaded file type is not allowed
                                    [imagever] => Yes
                                    [imtype] => 1
                                    [imgver_error_msg] => You have entered an incorrect verification code at the bottom of the form.
                                    [validate] => Yes
                                    [validatetype] => mootools
                                    [validate_onlyOnBlur] => 1
                                    [validate_wait] => 
                                    [validate_onlyOnSubmit] => 0
                                    [validation_type] => default
                                    [val_required] => 
                                    [val_validate_number] => 
                                    [val_validate_digits] => 
                                    [val_validate_alpha] => 
                                    [val_validate_alphanum] => 
                                    [val_validate_date] => 
                                    [val_validate_email] => 
                                    [val_validate_url] => 
                                    [val_validate_date_au] => 
                                    [val_validate_currency_dollar] => 
                                    [val_validate_selection] => 
                                    [val_validate_one_required] => 
                                    [val_validate_confirmation] => 
                                    [servervalidate] => Yes
                                    [autogenerated_order] => 3
                                    [onsubmitcode_order] => 2
                                    [plugins_order] => 1
                                    [plugins] => cf_cb_registration
                                    [mplugins_order] => 3
                                    [tablenames] => jos_rsmembership_membership_users,jos_users
                                )
                        )
                )
            [_errors] => Array
                (
                )
        )
    [formerrors] => 
    [formdebug] => Form passed first SPAM check OK
# # Form passed the submissions limit (if enabled) OK
# Form passed the Image verification (if enabled) OK
# Form passed the server side validation (if enabled) OK
# $_POST Array: Array ( [firstname] => Kyle [lastname] => Gonyea [cb_hospital] => Covenant Health System, Waterloo, IA [email] => facebook@zandergraphics.net [username] => tester [password] => test [password2] => test [user_id] => [name] => [membership_id] => 1 [id] => [published] => 1 [currency] => USD [cb_address] => 4315 Diplomacy Drive [chrono_verification] => 7xKEV [submit] => Register [76971322da0e2b4356cd8ce51c381d0d] => 1 [1cf1] => 7baeb0ea40603c54fe0b95f5be94ed90 [chronoformname] => register2 )
# $_FILES Array: Array ( )
# Form passed the plugins step (if enabled) OK
    [error_found] => 
    [stoprunning] => 
    [haltFunction] => Array
        (
            [emails] => 
            [uploads] => 
            [plugins_before_email] => 
            [plugins_after_email] => 
            [autogenerated_before_email] => 
            [autogenerated_after_email] => 
            [onsubmitcode] => 
            [onsubmitcodeb4] => 
        )
    [tablerow] => Array
        (
        )
    [posted] => Array
        (
            [firstname] => Kyle
            [lastname] => Gonyea
            [cb_hospital] => Covenant Health System, Waterloo, IA
            [email] => facebook@zandergraphics.net
            [username] => tester
            [password] => test
            [password2] => test
            [user_id] => 
            [name] => 
            [membership_id] => 1
            [id] => 
            [published] => 1
            [currency] => USD
            [cb_address] => 4315 Diplomacy Drive
            [chrono_verification] => 7xKEV
            [submit] => Register
            [76971322da0e2b4356cd8ce51c381d0d] => 1
            [1cf1] => 7baeb0ea40603c54fe0b95f5be94ed90
            [chronoformname] => register2
        )
    [pagetype] => chronocontact
    [formname] => ChronoContact_register2
    [stoploading] => 
    [submission_complete] => 
    [_errors] => Array
        (
        )
)
CFPlugins Object
(
    [thisformid] => 4
    [_errors] => Array
        (
        )
    [cf_joomla_registration] => Array
        (
            [errors] => 
            [user] => 
            [complete] => 
        )
    [cf_cb_registration] => Array
        (
            [errors] => This e-mail is already registered. If you forgot your password, click on the Forgot your password link and a new password will be sent to you.
            [user] => 
            [complete] => 
        )
)
					Hi,
Yes, that's fully readable. As for the error, it's explained here:
The registration failed, and as such, there is no new JUser-object available. $MyPlugins->cf_cb_registration['user'] is thus null. I suppose it would be a good idea to add a check if $MyPlugins->cf_cb_registration['errors'] is empty or not, and post the error message if it's not.
Give this a go, and try using a different email address for registration:
/Fredrik
				
				
				
			Yes, that's fully readable. As for the error, it's explained here:
[cf_cb_registration] => Array
        (
            [errors] => This e-mail is already registered. If you forgot your password, click on the Forgot your password link and a new password will be sent to you.
            [user] =>
            [complete] =>
        )The registration failed, and as such, there is no new JUser-object available. $MyPlugins->cf_cb_registration['user'] is thus null. I suppose it would be a good idea to add a check if $MyPlugins->cf_cb_registration['errors'] is empty or not, and post the error message if it's not.
Give this a go, and try using a different email address for registration:
<?
$MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id);
if (!empty($MyPlugins->cf_cb_registration['errors'])) {
  echo $MyPlugins->cf_cb_registration['errors'];
  return;
}
$user =& $MyPlugins->cf_cb_registration['user'];
$user->set('gid', 19);
$user->save();
?>/Fredrik
					Awesome. It worked this time. Apparently when I was deleting the test accounts through CB they were being left in jos_users so according to CB the username/emails were not there but when I searched the database, they were in there... but that's a whole different issue... 🙄 
Actually, I just went in and looked around more and it appears that while tinkering I turned on the jos_users database connection so it was actually creating two accounts each time and only deleting one... I turned that off and now it is working great.
Thanks for all your help... I've been trying to get all the parts of this registration for to work together and I think I am now very close... 😀
				
				
				
			Actually, I just went in and looked around more and it appears that while tinkering I turned on the jos_users database connection so it was actually creating two accounts each time and only deleting one... I turned that off and now it is working great.
Thanks for all your help... I've been trying to get all the parts of this registration for to work together and I think I am now very close... 😀
This topic is locked and no more replies can be posted.
		
	
 
  