Issues saving to DB after Joomla Registration

cy cyberrock 26 Oct, 2016
Hi Bob,
I have followed the FAQ page for getting the joomla user ID after the registration plugin with :
<?php
$form->data['user_id'] = $form->data['_PLUGINS_']['joomla_registration']['id'];
?>
In the debugger, I can see the user_id and value, though it is not being saved to the database

Array
(
    [chronoform] => Registeration
    [event] => submit
    [option] => com_chronoforms5
    [Name] => Ben
    [Email] => ben@gigreview.com.au
    [Password] => Packard12
    [Password2] => Packard12
    [Company] => 
    [Phone] => 1300416722
    [Address] => company drv
    [DefaultPUName] => 
    [DefaultPUPhone] => 
    [DefaultPUAddress] => 
    [DefaultDelName] => 
    [DefaultDelPhone] => 
    [DefaultDelAddress] => 
    [PaymentPreference] => 0
    [button32] => Register
    [name] => Ben
    [username] => ben@gigreview.com.au
    [email] => ben@gigreview.com.au
    [password] => Packard12
    [password2] => Packard12
    [_PLUGINS_] => Array
        (
            [joomla_registration] => Array
                (
                    [*isRoot] => 1
                    [id] => 140
                    [name] => Ben
                    [username] => **EMAIL**
                    [email] => **EMAIL**
                    [password] => $2y$10$M0SGbnU2eJ6WWgm7Sljwoe2Uu.sfu4kSJ4mOZMXyKmPjO.zy9utmS
                    [password_clear] => ************
                    [block] => 0
                    [sendEmail] => 1
                    [registerDate] => 2016-10-26 20:58:31
                    [lastvisitDate] => 2016-10-26 10:35:58
                    [activation] => 0
                    [groups] => Array
                        (
                            [0] => 10
                        )

                    [lastResetTime] => 0000-00-00 00:00:00
                    [resetCount] => 0
                    [requireReset] => 0
                    [*_params] => Joomla\Registry\Registry Object
                        (
                            [data:protected] => stdClass Object
                                (
                                )

                            [initialized:protected] => 1
                            [separator] => .
                        )

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

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

                    [*_authActions] => 
                    [*_errorMsg] => 
                    [*userHelper] => JUserWrapperHelper Object
                        (
                        )

                    [*_errors] => Array
                        (
                        )

                    [otpKey] => 
                    [otep] => 
                    [chronoform] => Registeration
                    [event] => submit
                    [option] => com_chronoforms5
                    [Name] => Ben
                    [Email] => **EMAIL**
                    [Password] => ************
                    [Password2] => ************
                    [Company] => 
                    [Phone] => 1300416722
                    [Address] => company drv
                    [DefaultPUName] => 
                    [DefaultPUPhone] => 
                    [DefaultPUAddress] => 
                    [DefaultDelName] => 
                    [DefaultDelPhone] => 
                    [DefaultDelAddress] => 
                    [PaymentPreference] => 0
                    [button32] => Register
                    [password2] => ************
                    [usertype] => deprecated
                )

        )

    [user_id] => 140
    [id] => 1
)


Array
(
    [9] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                            [0] => INSERT INTO `rwxoq_company_details` (`Company`, `Phone`, `Address`, `DefaultPUName`, `DefaultPUPhone`, `DefaultPUAddress`, `DefaultDelName`, `DefaultDelPhone`, `DefaultDelAddress`, `PaymentPreference`) values ('', '1300416722', 'company drv', '', '', '', '', '', '', '0');
                        )

                )

        )

)

Are you able to help please?

Thank you
Ben
Gr GreyHead 26 Oct, 2016
Hi Ben,

The User_id isn't showing up in the database INSERT statement. Please try clicking the Delete Cache icon in the Forms Manager toolbar to update CF's table records and see if that make the difference.

Bob
cy cyberrock 26 Oct, 2016
Thanks for the prompt reply Bob,
Array
(
    [10] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                            [0] => INSERT INTO `rwxoq_company_details` (`Company`, `Phone`, `Address`, `DefaultPUName`, `DefaultPUPhone`, `DefaultPUAddress`, `DefaultDelName`, `DefaultDelPhone`, `DefaultDelAddress`, `PaymentPreference`, `user_id`) values ('', '1300416722', 'dfdw', '', '', '', '', '', '', '0', '0');
                        )

                )

        )

)

It now shows that it is adding a value, though, it is always '0' i have tried to play around with it, but it is always 0..

I even placed an echo $form->data['user_id']; in the conditions, and it prints the proper value... it just doesnt like being saved in to the database


Ben
Gr GreyHead 27 Oct, 2016
Hi Ben,

Hmm . . . is the sequence of the actions like this: Joomla! Registration > Custom Code > DB Save ??

Bob
Gr GreyHead 27 Oct, 2016
Hi Ben,

Please try moving it into a Custom Code action before the DB Save action and see if that solves the problem.

Bob
cy cyberrock 27 Oct, 2016
1 Likes
Disregard.... Sorry Bob.. I just realized the i was using the updated conditions instead of a custom code.... It now works... thanks Bob
This topic is locked and no more replies can be posted.