Topic-icon Joomla user id in register redirect

Active Subscriptions:

None
13 years 5 months ago #29570 by marpin1
Hallo,

i need to redirect first time registered users to a form page where some field of the form is prefilled with their data from DB tabel _users, This is the form page: www.marcopinetti.it/fbreg?view=form. What i basically need is to append to this url the Joomla user ID generated by JFBC.

How to do it? There is no trace of this parameter in any URL call of the registration process.

Thanks.
The topic has been locked.
Support Specialist
13 years 5 months ago #29577 by alzander
Marco,
After the user registers, they are usually automatically logged in. If you aren't activating the user, then you can simply ask Joomla what user is logged in by using JFactory::getUser.

If that doesn't work for you and you need something else, let us know,
Alex
The topic has been locked.
Active Subscriptions:

None
13 years 5 months ago #29581 by marpin1
Thanks Alex,

i know the user is logged in, but i want to ask him some more info through a Chronoforms form that fills in a specific db table. So I want to load the form with fields "name" and "Email" pre-filled. That's why i need the ID (Joomla user ID) in the URL.
As far as i know JFactory is not supported i 2.5. If supperted, where should I add the proper code to have the ID in the URL? The result i need is something like: www.marcopinetti.it/fbreg?view=form&id=507

Thanks

_m
The topic has been locked.
Support Specialist
13 years 5 months ago #29585 by alzander
Marco,
I understand what you're saying, but I still think you're going about it wrong. First off, if the user has already registered, you have their email address. Asking that again (or prefilling it) will likely reduce the amount of users that fill out the form.

Understandably though, you may want them to verify or be able to change it though. I haven't worked with Chronoforms before, but every form software I've used in the past allows pre-filling information based on the current user. I would expect Chronoform to have that. If it doesn't, then I would recommend using the following code somewhere to get the user information:
$user = JFactory::getUser();
$email = $user->get('email');
You can then use that value to pre-fill the form if you want. I'm assuming there's a code place in Chronoforms where you can add that, but again, I don't know that extension.

The reason I would not recommend updating our redirection URL is that you will need to re-do that change with every update of JFBConnect. That will likely cause things to break at some point. Doing it in Chronoform keeps things more contained to just that extension, and again, there likely already is some method to fetch the email and user id in Chronoform already.

Hope that explains. If you insist, I can look into where and what to change to add the id to the URL, but it may take a day or so to get you a response.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
13 years 5 months ago #29597 by marpin1
Hi Alex,

i need to ask users to add some data that is not stored in facebook, so an additional form is required. I followed your suggestion and found a third party add-on for Chronoforms that loads user data exactly as i need. now everything works well. Test if you want!

BTW: many thanks for GREAT support. I'll review it 5 stars on Joomla.org!

_m
The topic has been locked.
Support Specialist
13 years 5 months ago #29604 by alzander
Marco,
Glad to hear you found what you were looking for. As you could tell, I really didn't like the idea of doing that in JFBConnect as pre-filling data is what a form extension should already be able to do :)

We'd love to have that review, if you haven't already submitted it, and really appreciate your time in doing so!

Thanks, and good luck,
Alex
The topic has been locked.