Forums

Registration Additional Fields Not Writing User_ID

lydianp18 14 Oct, 2013
Latest version of chronoforms 4 and Joomla 2.5.14

Two problems with custom registration form with chronoforms:

#1 - Additional field not writing User id to 2nd table ( ifjo4_users_info)

Right now I only have 1 additional field "sex" it is writing to the info table, however it's not writing the newly generated user id to the ifjo4_users_info table. Screen cap of my Events tab is attached (I've tried the custom code and DB Save also after onFail (not inside onFail) still inside Joomla User Reg - and it doesn't matter, same result)

Joomla Reg settings:
Override Joomla Allow: yes
Usertype: Registered
User activation: no
Send Activation: no
Random Pass: no
Auto Login: yes
display status: no

Custom Code:
Mode: controller
Code:
<?php
$form->data['user_id'] = $form->data['_PLUGINS_']['givve_reg']['id'];
?>


The form is called "givve_reg" I've also tried that variable as "joomla_registration" it makes no difference, same results.

DB Save:
Enabled: yes
Table: ifjo4_users_info
Model ID: chronoform_data
Save under model Id: no

--------------------------------------------------------------------------

Problem #2 - it's writing fine to the users table except for Usertype: Registered, that's comes back as "depricated"


Thanks
Lydia
Max_admin 17 Oct, 2013
Hi Lydia,

Q#2, is fine, that's how new Joomla works, there is a different table to store that!

Q#1, Please use a "Debugger" action to check the path of the new created user in the data array, this should help you write the code correctly!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
lydianp18 17 Oct, 2013
Max,

Thanks for the reply, but I'm still lost. I'm not a programmer, but usually I can take a snippet of code (like this one) from the forums and get it to work. No matter what I try it's not working.

<?php
$form->data['user_id'] = $form->data['_PLUGINS_']['givve_reg']['id'];
?>


I've tried changing: ['user_id'] & ['givve_reg'] & ['id'] it doesn't seem to make a difference. Can I get another hint? :mrgreen:

If I'm reading the debugging right... it almost looks like it's not writing the user id to the info table (it's only writing sex), but I have no clue where to go from there.:
Max_admin 20 Oct, 2013
Hi Lydia,

No, I mean the "Debugger" action in Chronoforms, please drag it after the "Joomla registration" action, it should display the full data array and then you can find under which keys is the data you need.

What you have here is the Joomla SQL debug!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
lydianp18 21 Oct, 2013
;-) Thanks. Knew I was missing something.
lydianp18 24 Oct, 2013
Still can't figure this out. I've tried every combination I can think of, I've been back through every post in the forum even remotely related. I even changed id column name in the 2nd table to match the one Bob uses all the time in his examples for this "users_id" - it still won't write the id to the 2nd table. Below is the debug:
Debug:

Array
(
    [option] => com_chronoforms
    [tmpl] => component
    [chronoform] => givve_reg
    [event] => submit
    [Itemid] => 
    [name] => Test Case
    [username] => tcvsasd
    [email] => lydianp@yahoo.com
    [password] => bangkok1
    [password2] => bangkok1
    [sex] => FEMALE
    [input_submit_7] => Submit
    [8e61029ec8dfa164c1158fc42a74a54e] => 1
    [_PLUGINS_] => Array
        (
            [joomla_registration] => Array
                (
                    [*isRoot] => 
                    [id] => 1019
                    [name] => Test Case
                    [username] => tcvsasd
                    [email] => lydianp@yahoo.com
                    [password] => 0f72c53e8cc634f952ade4cd7eccfaa1:8fwPiXrkWd5Ub5OS6itpuzrifwkXhQJA
                    [password_clear] => bangkok1
                    [usertype] => deprecated
                    [block] => 0
                    [sendEmail] => 0
                    [registerDate] => 2013-10-24 20:41:27
                    [lastvisitDate] => 0000-00-00 00:00:00
                    [activation] => 
                    [groups] => Array
                        (
                            [0] => 2
                        )

                    [lastResetTime] => 0000-00-00 00:00:00
                    [resetCount] => 0
                    [*_params] => JRegistry Object
                        (
                            [data:protected] => stdClass Object
                                (
                                )

                        )

                    [*_authGroups] => Array
                        (
                            [0] => 1
                            [1] => 2
                        )

                    [*_authLevels] => Array
                        (
                            [0] => 1
                            [1] => 1
                            [2] => 2
                        )

                    [*_authActions] => 
                    [*_errorMsg] => 
                    [*_errors] => Array
                        (
                        )

                    [aid] => 0
                    [option] => com_chronoforms
                    [tmpl] => component
                    [chronoform] => givve_reg
                    [event] => submit
                    [Itemid] => 
                    [password2] => bangkok1
                    [sex] => FEMALE
                    [input_submit_7] => Submit
                    [8e61029ec8dfa164c1158fc42a74a54e] => 1
                )

        )

    [user_id] => 
    [chronoform_data] => Array
        (
            [cf_uid] => dde042c4b77b0f50df06e5574b9a5ace
            [cf_created] => 2013-10-24 15:41:27
            [cf_created_by] => 1019
            [cf_ipaddress] => 66.214.235.224
            [cf_user_id] => 1019
            [option] => com_chronoforms
            [tmpl] => component
            [chronoform] => givve_reg
            [event] => submit
            [Itemid] => 
            [name] => Test Case
            [username] => tcvsasd
            [email] => lydianp@yahoo.com
            [password] => bangkok1
            [password2] => bangkok1
            [sex] => FEMALE
            [input_submit_7] => Submit
            [8e61029ec8dfa164c1158fc42a74a54e] => 1
            [_PLUGINS_] => Array
                (
                    [joomla_registration] => Array
                        (
                            [*isRoot] => 
                            [id] => 1019
                            [name] => Test Case
                            [username] => tcvsasd
                            [email] => lydianp@yahoo.com
                            [password] => 0f72c53e8cc634f952ade4cd7eccfaa1:8fwPiXrkWd5Ub5OS6itpuzrifwkXhQJA
                            [password_clear] => bangkok1
                            [usertype] => deprecated
                            [block] => 0
                            [sendEmail] => 0
                            [registerDate] => 2013-10-24 20:41:27
                            [lastvisitDate] => 0000-00-00 00:00:00
                            [activation] => 
                            [groups] => Array
                                (
                                    [0] => 2
                                )

                            [lastResetTime] => 0000-00-00 00:00:00
                            [resetCount] => 0
                            [*_params] => JRegistry Object
                                (
                                    [data:protected] => stdClass Object
                                        (
                                        )

                                )

                            [*_authGroups] => Array
                                (
                                    [0] => 1
                                    [1] => 2
                                )

                            [*_authLevels] => Array
                                (
                                    [0] => 1
                                    [1] => 1
                                    [2] => 2
                                )

                            [*_authActions] => 
                            [*_errorMsg] => 
                            [*_errors] => Array
                                (
                                )

                            [aid] => 0
                            [option] => com_chronoforms
                            [tmpl] => component
                            [chronoform] => givve_reg
                            [event] => submit
                            [Itemid] => 
                            [password2] => bangkok1
                            [sex] => FEMALE
                            [input_submit_7] => Submit
                            [8e61029ec8dfa164c1158fc42a74a54e] => 1
                        )

                )

            [user_id] => 
        )

    [chronoform_data_user_id] => 
)
Validation Errors: 
Array
(
)


Here's the current Code plugged in to Custom Code:
<?php
$form->data['user_id'] = $form->data['_PLUGINS_']['joomla_registration']->id;
?>


Attached is a screen cap of the events tab too.
GreyHead 26 Oct, 2013
Hi Lydia,

It's an array in this case, not a object so please try:
<?php
$form->data['user_id'] = $form->data['_PLUGINS_']['joomla_registration']['id'];
?>

Bob
lydianp18 26 Oct, 2013
Bob,

Thanks. I had it that way at one point... I've got it back there now, and the debug looks right - it's filling in the right id number in the right places, but now it won't write to the 2nd (users_info) table. (If I remove the custom code, it writes to the info table without the user_id...).
The custom code is now:
<?php
$form->data['user_id'] = $form->data['_PLUGINS_']['joomla_registration']['id'];
?>

The debug looks like:
Array
(
    [option] => com_chronoforms
    [tmpl] => component
    [chronoform] => givve_reg
    [event] => submit
    [Itemid] => 
    [name] => Test Case
    [username] => tester4
    [email] => test@mail2.com
    [password] => bangkok1
    [password2] => bangkok1
    [sex] => FEMALE
    [input_submit_7] => Submit
    [74f23928c62d6d8f3ef671c189585914] => 1
    [_PLUGINS_] => Array
        (
            [joomla_registration] => Array
                (
                    [*isRoot] => 
                    [id] => 1031
                    [name] => Test Case
                    [username] => tester4
                    [email] => test@mail2.com
                    [password] => 39bce6d901a3685b92dc043415e9c623:eq1pqQjUOcgcpviatbHlW05LDH44n9T3
                    [password_clear] => bangkok1
                    [usertype] => deprecated
                    [block] => 0
                    [sendEmail] => 0
                    [registerDate] => 2013-10-26 21:45:30
                    [lastvisitDate] => 0000-00-00 00:00:00
                    [activation] => 
                    [groups] => Array
                        (
                            [0] => 2
                        )

                    [lastResetTime] => 0000-00-00 00:00:00
                    [resetCount] => 0
                    [*_params] => JRegistry Object
                        (
                            [data:protected] => stdClass Object
                                (
                                )

                        )

                    [*_authGroups] => Array
                        (
                            [0] => 1
                            [1] => 2
                        )

                    [*_authLevels] => Array
                        (
                            [0] => 1
                            [1] => 1
                            [2] => 2
                        )

                    [*_authActions] => 
                    [*_errorMsg] => 
                    [*_errors] => Array
                        (
                        )

                    [aid] => 0
                    [option] => com_chronoforms
                    [tmpl] => component
                    [chronoform] => givve_reg
                    [event] => submit
                    [Itemid] => 
                    [password2] => bangkok1
                    [sex] => FEMALE
                    [input_submit_7] => Submit
                    [74f23928c62d6d8f3ef671c189585914] => 1
                )

        )

    [user_id] => 1031
    [chronoform_data] => Array
        (
            [cf_modified] => 2013-10-26 16:45:30
            [cf_modified_by] => 1031
            [option] => com_chronoforms
            [tmpl] => component
            [chronoform] => givve_reg
            [event] => submit
            [Itemid] => 
            [name] => Test Case
            [username] => tester4
            [email] => test@mail2.com
            [password] => bangkok1
            [password2] => bangkok1
            [sex] => FEMALE
            [input_submit_7] => Submit
            [74f23928c62d6d8f3ef671c189585914] => 1
            [_PLUGINS_] => Array
                (
                    [joomla_registration] => Array
                        (
                            [*isRoot] => 
                            [id] => 1031
                            [name] => Test Case
                            [username] => tester4
                            [email] => test@mail2.com
                            [password] => 39bce6d901a3685b92dc043415e9c623:eq1pqQjUOcgcpviatbHlW05LDH44n9T3
                            [password_clear] => bangkok1
                            [usertype] => deprecated
                            [block] => 0
                            [sendEmail] => 0
                            [registerDate] => 2013-10-26 21:45:30
                            [lastvisitDate] => 0000-00-00 00:00:00
                            [activation] => 
                            [groups] => Array
                                (
                                    [0] => 2
                                )

                            [lastResetTime] => 0000-00-00 00:00:00
                            [resetCount] => 0
                            [*_params] => JRegistry Object
                                (
                                    [data:protected] => stdClass Object
                                        (
                                        )

                                )

                            [*_authGroups] => Array
                                (
                                    [0] => 1
                                    [1] => 2
                                )

                            [*_authLevels] => Array
                                (
                                    [0] => 1
                                    [1] => 1
                                    [2] => 2
                                )

                            [*_authActions] => 
                            [*_errorMsg] => 
                            [*_errors] => Array
                                (
                                )

                            [aid] => 0
                            [option] => com_chronoforms
                            [tmpl] => component
                            [chronoform] => givve_reg
                            [event] => submit
                            [Itemid] => 
                            [password2] => bangkok1
                            [sex] => FEMALE
                            [input_submit_7] => Submit
                            [74f23928c62d6d8f3ef671c189585914] => 1
                        )

                )

            [user_id] => 1031
        )

    [chronoform_data_user_id] => 1031
)
Validation Errors: 
Array
(
)


And the way I have things setup on the Events tab is attached:
(note: I've tried putting just the db save in between Joomla registration and debug, and both code and db save in between Joomla registration and debug - neither helps.)

Do I need to put something in the parameters part of the db save settings? or maybe change the model id (it's set to chronoform_data?

Thanks.
Lydia
GreyHead 27 Oct, 2013
Hi Lydia,

Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.

That should show you the exact name for the user id.

Bob
This topic is locked and no more replies can be posted.