Forums

cf_user_id not updating with jos_users_id

das6502 13 Jun, 2011
I created a replacement Joomla registration form using CF v4 and everything seems to work fine, When the registration form is submitted the data does get posted to the jos_users table and the newly created CF table, however, in the CF table the cf_user_id does not have the jos_users_id listed. It list a zero. In searching the forums, I understand that the cf_user_id remains a zero unless the person is logged in. Is this correct? [attachment=1]image1.jpg[/attachment]
I have tried logging in with the test user and the cf_user_id remains zero. Am i misunderstanding how CF works? Also, how do I match users in the the new CF registration table with jos_user table if the cf_user_id remains at zero? This is how I set up my CF form. Did I do it correctly? Any assistance is greatly appreciated.[attachment=0]image2.jpg[/attachment]
GreyHead 23 Aug, 2011
Hi das6502 ,

I just re-found this old post of yours.

If I remember the code correctly when you do a DataBase save with ChronoForms it will set the value of cf_user_id as follows:
[list=1]
  • If there is a value set in the form results use that

  • If the user is logged in use their id

  • Use zero '0' - as you say this is the 'guest' user id.
  • [/list:o]

    Bob
    das6502 29 Sep, 2011
    I understand the concept that when you create a form that the cf_user_id field will be populated with the jos_users_id if the user is logged in when they are filling out the form. Otherwise cf_user_id will be set to Zero.

    My question would then be, when you are creating a custom registration form using Chronoforms to replace Joomla's system registration form, how do you get the cf_user_id to be set to the jos_user_id upon submission of the registration form knowing that the user does not have a previously established account can not log into Joomla to fill out the form?

    This is the piece that is confusing me because new users do not have the ability to log in until after they have registered using the custom registration form (of course), but the cf_user_id field does not get populated with the jos_users_id unless the user is logged in. There seems to be a disconnect. How would I be able to match up the users in the jos_users table to the users in the chronoforms_addInfo table if everyone who fills out the registration form a zero is returned for their cf_user_id? I must be missing something when I am setting up the custom registration form in Chronoforms. Any ideas? As always your help is greatly appreciated.
    das6502 30 Sep, 2011
    First let me apologies for the very long winded response below, but I am just a bit confused and hope you can help.

    This is what I am trying to accomplish. I need to create a custom registration form because Joomla registration form because we need to capture more information then what Joomla is capturing on their registration form. Not a big deal as I know how to use Chronoforms to accomplish this. I created a custom form and connected the form to a newly created table called additionalInfo and used the Joomla registration action found in version 4.

    I do understand what your saying about the cf_user_id will be assigned a zero if the user is not signed in when they fill out the form. I have tested this and that is correct. However, what is confusing me is that when you create a custom registration form to replace the Joomla system registration form, the user can not be signed in before filling out the form because they have NOT registered yet.

    In version 3, when I selected the Joomla Registration plugin, the cf_user_id in the connected table would automatically get populated with the jos_users_id once the form was submitted. This allowed me to match the users in the jos_users table with the users in the additionalInfo table that I created with Chronoforms. However in version 4, when I select the Joomla registration item from the actions menu I can't seem to get the jos_users_id data into the cf_user_id field. It always end up being a zero (Yes I know it's because the user is not signed in). Obviously I must be missing something when I create the registration form. What do I need to do to get the jos_users_id data into the cf_user_id field without them having to be signed in?

    If this isn't possible with version 4 how would I be able to match users from jos_users with the users users in the additionalInfo table if the cf_user_id is zero for all the users who fill out the form?

    Again sorry for the long winded message and I do thank you for any assistance you can provide.
    GreyHead 01 Oct, 2011
    Hi das6502,

    The Joomla! Registration action adds the new User object into $form->data['_PLUGINS_']['joomla_registration'] so you should be able to get the id from $form->data['_PLUGINS_']['joomla_registration']['id']

    The problem with the cf_user_id column in CFv3 was that if the form was later edited by an admin (or another user) the 'original' user id could easily be over-written.

    Bob

    Late: Fixed mistake: replaced ->id with ['id'] see later post
    squawk 02 Nov, 2011
    Did anyone find a solution to this as the $form->data['_PLUGINS_']['joomla_registration']->id doesn't seem to be working?

    Thanks in advance
    ist_04 23 Nov, 2011
    If you have not found an answer, try this:

    In your form Events tab, edit Joomla Registration. Got to Settings tab and scroll down and choose yes to Auto Log In.

    This worked form me and matche dthe cf_user_id with Joomla's
    hernacar 30 Dec, 2011

    Hi das6502,

    The Joomla! Registration action adds the new User object into $form->data['_PLUGINS_']['joomla_registration'] so you should be able to get the id from $form->data['_PLUGINS_']['joomla_registration']->id



    Looks like Bob had a minor type-o (I think I just had one, too). But that's OK; the man does so much for us, he even gives a dummy like me an opportunity to test myself to improve my CF skills. 😶

    The correct path to the requested id is:
    $form->data['_PLUGINS_']['joomla_registration']['id']

    I tested with CF4 RC3 and it works beautifully!

    Cheers! 😀
    GreyHead 30 Dec, 2011
    Hi hernacar,

    Thanks for spotting that, I fixed my earlier post.

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