Forums

customized field and CB registration

alfredopacino 02 Nov, 2013
hi, i have some custom field (birthdaty,height,weight) in my form, but obviously on submit they get lost in CB/joomla registration, how can i "link" those filed with the custom CB field in database?
GreyHead 02 Nov, 2013
Hi alfredpacino,

You can use either a DB Save action (or actions) or a hand-coded MySQL query in a Custom Code action.

Bob
alfredopacino 02 Nov, 2013
yep i know, but in joomla registration action there is CB option, so i wondering if there is a "automatic" method for save those fields..it should be..
alfredopacino 02 Nov, 2013
i tryng db save action (on comprofiler table), but:
with db save on comprofiler i basically override the CB option in joomla registration, ok then, but during the registration how can i recovery the joomla registration id to save that in user_id field in comprofiler table?

for better explain:
joomla registration action gives the user an id
in the case below id=980
i have to save this in "id" and "user_id" field in comprofiler table, otherwise those field are = 0.
Array
(
    [chronoform] => Iscrizione
    [event] => submit
    [Itemid] => 137
    [option] => com_chronoforms
    [view] => form
    [confirmation_page] => _confirm
    [name] => 432
    [username] => 432
    [email] => 432@432.dom
    [password] => 432
    [password2] => 432
    [datebirth] => 2013-11-07
    [peso] => 432
    [cb_profilo] => 
432


    [cb_esperienze] => 
432


    [input_submit_25] => Iscriviti
    [354c353d59830c592f140a72bb23c468] => 1
    [_FORM_FILES_] => Array
        (
        )

    [_PLUGINS_] => Array
        (
            [joomla_registration] => Array
                (
                    [*isRoot] => 
                    [id] => 980
                    [name] => 432
                    [username] => 432
                    [email] => 432@432.dom
                    [password] => 767153e992dc979faf15cd2229b62934:8iLY1VkYYo26GOWOwROzLW7Fj2WFX4zH
                    [password_clear] => 432
                    [usertype] => deprecated
                    [block] => 1
                    [sendEmail] => 0
                    [registerDate] => 2013-11-02 16:59:51
                    [lastvisitDate] => 
                    [activation] => abb44904ed9e309cfb081680c62959f5
                    [groups] => Array
                        (
                            [0] => 2
                        )

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

                        )

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

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

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

                    [aid] => 0
                    [chronoform] => Iscrizione
                    [event] => submit
                    [Itemid] => 137
                    [option] => com_chronoforms
                    [view] => form
                    [confirmation_page] => _confirm
                    [password2] => 432
                    [datebirth] => 2013-11-07
                    [peso] => 432
                    [cb_profilo] => 
432


                    [cb_esperienze] => 
432


                    [input_submit_25] => Iscriviti
                    [354c353d59830c592f140a72bb23c468] => 1
                    [_FORM_FILES_] => Array
                        (
                        )

                )

        )

    [chronoform_data] => Array
        (
            [cf_uid] => 20fa7612242eb3c04834558ad8e385a3
            [cf_created] => 2013-11-02 17:59:51
            [cf_created_by] => 0
            [cf_ipaddress] => ::1
            [cf_user_id] => 0
            [chronoform] => Iscrizione
            [event] => submit
            [Itemid] => 137
            [option] => com_chronoforms
            [view] => form
            [confirmation_page] => _confirm
            [name] => 432
            [username] => 432
            [email] => 432@432.dom
            [password] => 432
            [password2] => 432
            [datebirth] => 2013-11-07
            [peso] => 432
            [cb_profilo] => 
432


            [cb_esperienze] => 
432


            [input_submit_25] => Iscriviti
            [354c353d59830c592f140a72bb23c468] => 1
            [_FORM_FILES_] => Array
                (
                )

            [_PLUGINS_] => Array
                (
                    [joomla_registration] => Array
                        (
                            [*isRoot] => 
                            [id] => 980
                            [name] => 432
                            [username] => 432
                            [email] => 432@432.dom
                            [password] => 767153e992dc979faf15cd2229b62934:8iLY1VkYYo26GOWOwROzLW7Fj2WFX4zH
                            [password_clear] => 432
                            [usertype] => deprecated
                            [block] => 1
                            [sendEmail] => 0
                            [registerDate] => 2013-11-02 16:59:51
                            [lastvisitDate] => 
                            [activation] => abb44904ed9e309cfb081680c62959f5
                            [groups] => Array
                                (
                                    [0] => 2
                                )

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

                                )

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

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

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

                            [aid] => 0
                            [chronoform] => Iscrizione
                            [event] => submit
                            [Itemid] => 137
                            [option] => com_chronoforms
                            [view] => form
                            [confirmation_page] => _confirm
                            [password2] => 432
                            [datebirth] => 2013-11-07
                            [peso] => 432
                            [cb_profilo] => 
432


                            [cb_esperienze] => 
432


                            [input_submit_25] => Iscriviti
                            [354c353d59830c592f140a72bb23c468] => 1
                            [_FORM_FILES_] => Array
                                (
                                )

                        )

                )

            [id] => 
        )

    [chronoform_data_id] => 
)
GreyHead 04 Nov, 2013
Hi alfredopacino,

The value 980 is set in $form->data['_PLUGINS_']['joomla_registration']['id'] so you can use that; normally it should be in $form->data['chronoform_data_id'] but that is empty in your results - I'm not clear why.

Bob
alfredopacino 16 Nov, 2013
Tablecomprofiler: :store failed - Duplicate entry '0' for key 'PRIMARY' SQL=INSERT INTO `za60s_comprofiler` (`cb_esperienze`,`cb_profilo`) VALUES ('','')


i still have this issue and i wondering why is it possible, the CB option in joomla registration action should solve this automatically.
how can i store $form->data[chronoform_data]->[cf_user_id] in the table fields comprofiler->id and userid using DB save?

otherwise i think the problem is the chronoform_data_id empty value, solving this issue i think i can solve the store problem
Max_admin 16 Nov, 2013
Hi,

Just pass it in the data array:


$form->data['id'] = $form->data['chronoform_data']['cf_user_id'];


I don't think that the data path you provided is correct though, so you should double check that!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
alfredopacino 16 Nov, 2013
do you mean the user data path in joomla registration action?
now is named "userdata"

i noticed that: if in comprofiler table there is another record id=userid=0 the registration returns me this storage error
Tablecomprofiler: :store failed - Duplicate entry '0' for key 'PRIMARY' SQL=INSERT INTO `za60s_comprofiler` (`cb_esperienze`,`cb_profilo`) VALUES ('yyyrrr','yyyrrr')
but saves correctly in comprofiler (with correct id and userid)

i really don't know how to figure it out😟

how can i pass the id value in the data array? which action?

this is the last debugger print (there is the record id=995 user in comprofiler, but i still get the storage error)
Array
(
    [chronoform] => Iscrizione
    [event] => submit
    [Itemid] => 137
    [option] => com_chronoforms
    [view] => form
    [confirmation_page] => _confirm
    [name] => rrryyy
    [username] => rrryyy
    [email] => rrryyy@99.com
    [password] => yyy
    [password2] => yyy
    [datebirth] => 2013-11-20
    [sesso] => 
    [altezza] => yyy
    [peso] => yyy
    [cb_profilo] => 
yyyrrr


    [aspirazione] => modellao
    [cb_esperienze] => 
yyyrrr


    [input_text_52] => 
    [input_text_69] => 
    [input_text_67] => 
    [privacy] => 
    [input_submit_25] => Iscriviti
    [5dee6148d3b3324c53e0ae027afb492c] => 1
    [_FORM_FILES_] => Array
        (
        )

    [_PLUGINS_] => Array
        (
            [joomla_registration] => Array
                (
                    [*isRoot] => 
                    [id] => 995
                    [name] => rrryyy
                    [username] => rrryyy
                    [email] => rrryyy@99.com
                    [password] => c6cf4118a8f3088cf197e8268d7cd943:Ql12L6dyCjozyLP4aSmK2467cuMjJHGu
                    [password_clear] => yyy
                    [usertype] => deprecated
                    [block] => 1
                    [sendEmail] => 0
                    [registerDate] => 2013-11-16 22:51:13
                    [lastvisitDate] => 
                    [activation] => 9ad4b4cbc4eff4987c8d8f981a6da121
                    [groups] => Array
                        (
                            [0] => 2
                        )

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

                        )

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

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

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

                    [aid] => 0
                    [chronoform] => Iscrizione
                    [event] => submit
                    [Itemid] => 137
                    [option] => com_chronoforms
                    [view] => form
                    [confirmation_page] => _confirm
                    [password2] => yyy
                    [datebirth] => 2013-11-20
                    [sesso] => 
                    [altezza] => yyy
                    [peso] => yyy
                    [cb_profilo] => 
yyyrrr


                    [aspirazione] => modellao
                    [cb_esperienze] => 
yyyrrr


                    [input_text_52] => 
                    [input_text_69] => 
                    [input_text_67] => 
                    [privacy] => 
                    [input_submit_25] => Iscriviti
                    [5dee6148d3b3324c53e0ae027afb492c] => 1
                    [_FORM_FILES_] => Array
                        (
                        )

                )

        )

    [userdata] => Array
        (
            [*isRoot] => 
            [id] => 995
            [name] => rrryyy
            [username] => rrryyy
            [email] => rrryyy@99.com
            [password] => c6cf4118a8f3088cf197e8268d7cd943:Ql12L6dyCjozyLP4aSmK2467cuMjJHGu
            [password_clear] => yyy
            [usertype] => deprecated
            [block] => 1
            [sendEmail] => 0
            [registerDate] => 2013-11-16 22:51:13
            [lastvisitDate] => 
            [activation] => 9ad4b4cbc4eff4987c8d8f981a6da121
            [groups] => Array
                (
                    [0] => 2
                )

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

                )

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

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

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

            [aid] => 0
            [chronoform] => Iscrizione
            [event] => submit
            [Itemid] => 137
            [option] => com_chronoforms
            [view] => form
            [confirmation_page] => _confirm
            [password2] => yyy
            [datebirth] => 2013-11-20
            [sesso] => 
            [altezza] => yyy
            [peso] => yyy
            [cb_profilo] => 
yyyrrr


            [aspirazione] => modellao
            [cb_esperienze] => 
yyyrrr


            [input_text_52] => 
            [input_text_69] => 
            [input_text_67] => 
            [privacy] => 
            [input_submit_25] => Iscriviti
            [5dee6148d3b3324c53e0ae027afb492c] => 1
            [_FORM_FILES_] => Array
                (
                )

        )

    [chronoform_data] => Array
        (
            [cf_uid] => 7807282e88f61f94046b32ae70644ced
            [cf_created] => 2013-11-16 23:51:13
            [cf_created_by] => 0
            [cf_ipaddress] => ::1
            [cf_user_id] => 0
            [chronoform] => Iscrizione
            [event] => submit
            [Itemid] => 137
            [option] => com_chronoforms
            [view] => form
            [confirmation_page] => _confirm
            [name] => rrryyy
            [username] => rrryyy
            [email] => rrryyy@99.com
            [password] => yyy
            [password2] => yyy
            [datebirth] => 2013-11-20
            [sesso] => 
            [altezza] => yyy
            [peso] => yyy
            [cb_profilo] => 
yyyrrr


            [aspirazione] => modellao
            [cb_esperienze] => 
yyyrrr


            [input_text_52] => 
            [input_text_69] => 
            [input_text_67] => 
            [privacy] => 
            [input_submit_25] => Iscriviti
            [5dee6148d3b3324c53e0ae027afb492c] => 1
            [_FORM_FILES_] => Array
                (
                )

            [_PLUGINS_] => Array
                (
                    [joomla_registration] => Array
                        (
                            [*isRoot] => 
                            [id] => 995
                            [name] => rrryyy
                            [username] => rrryyy
                            [email] => rrryyy@99.com
                            [password] => c6cf4118a8f3088cf197e8268d7cd943:Ql12L6dyCjozyLP4aSmK2467cuMjJHGu
                            [password_clear] => yyy
                            [usertype] => deprecated
                            [block] => 1
                            [sendEmail] => 0
                            [registerDate] => 2013-11-16 22:51:13
                            [lastvisitDate] => 
                            [activation] => 9ad4b4cbc4eff4987c8d8f981a6da121
                            [groups] => Array
                                (
                                    [0] => 2
                                )

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

                                )

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

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

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

                            [aid] => 0
                            [chronoform] => Iscrizione
                            [event] => submit
                            [Itemid] => 137
                            [option] => com_chronoforms
                            [view] => form
                            [confirmation_page] => _confirm
                            [password2] => yyy
                            [datebirth] => 2013-11-20
                            [sesso] => 
                            [altezza] => yyy
                            [peso] => yyy
                            [cb_profilo] => 
yyyrrr


                            [aspirazione] => modellao
                            [cb_esperienze] => 
yyyrrr


                            [input_text_52] => 
                            [input_text_69] => 
                            [input_text_67] => 
                            [privacy] => 
                            [input_submit_25] => Iscriviti
                            [5dee6148d3b3324c53e0ae027afb492c] => 1
                            [_FORM_FILES_] => Array
                                (
                                )

                        )

                )

            [userdata] => Array
                (
                    [*isRoot] => 
                    [id] => 995
                    [name] => rrryyy
                    [username] => rrryyy
                    [email] => rrryyy@99.com
                    [password] => c6cf4118a8f3088cf197e8268d7cd943:Ql12L6dyCjozyLP4aSmK2467cuMjJHGu
                    [password_clear] => yyy
                    [usertype] => deprecated
                    [block] => 1
                    [sendEmail] => 0
                    [registerDate] => 2013-11-16 22:51:13
                    [lastvisitDate] => 
                    [activation] => 9ad4b4cbc4eff4987c8d8f981a6da121
                    [groups] => Array
                        (
                            [0] => 2
                        )

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

                        )

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

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

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

                    [aid] => 0
                    [chronoform] => Iscrizione
                    [event] => submit
                    [Itemid] => 137
                    [option] => com_chronoforms
                    [view] => form
                    [confirmation_page] => _confirm
                    [password2] => yyy
                    [datebirth] => 2013-11-20
                    [sesso] => 
                    [altezza] => yyy
                    [peso] => yyy
                    [cb_profilo] => 
yyyrrr


                    [aspirazione] => modellao
                    [cb_esperienze] => 
yyyrrr


                    [input_text_52] => 
                    [input_text_69] => 
                    [input_text_67] => 
                    [privacy] => 
                    [input_submit_25] => Iscriviti
                    [5dee6148d3b3324c53e0ae027afb492c] => 1
                    [_FORM_FILES_] => Array
                        (
                        )

                )

            [id] => 
        )

    [chronoform_data_id] => 
)
alfredopacino 19 Nov, 2013
instead of watch my code, can you provide me a sample form (cf4bak) of joomla registration (with CB option) with name, email, password and just a custom CB field (for example cb_experiences).
This should be very easy for you and it could be useful for many others
Max_admin 22 Nov, 2013
Hi Alfredo,

I just don't have any experience with CB to test this, and I don't know the CB table info, but if the CB table has field named "id" and its a "primary key" then this code should work:

$form->data['id'] = $form->data['userdata']['id'];


it should be placed before the "Db save" to the CB table!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.