Forums

Dynamic URL ReDirect to Access Saved Data

ist_04 17 Nov, 2011
[J1.7][CF 4]

I am having issues with accessing saved user data via a dynamic URL.

I created a form to use for a registration and tied it into Joomla's user reg with no prob's. Then connected a DB, and all the data saves. Went a step further and used the new CSV Export to add a front end link to download a spreadsheet with lil issues. Now i am stuck with accessing the info to edit.

I dup'd the original form to set up a user registration edit form. I used the DB Loader to access the data for a user per the tutorial, and now i can populate the info, edit & save. The only change i did was use cf_user_id instead of cf_uid. Perfect.

Now i cannot access the page. I know the URL, /index.php?option=com_chronoforms&chronoform=LoadUserInfo&token=43 (cf_user_id), for one user, but i cannot figure out how to:

1. Dynamically produce the cf_user_id based on the logged in user. The idea is a user will one day register, then another day come back to update info. I have searched, and found various code to access user id:

<?php
$user = &JFactory::getUser();
echo "id = ".$user->id
?>


<?php
$user = &JFactory::getUser();
echo "cf_user_id = ".$user->id
?>


Most have posted to add this to the DB Loader WHERE statement. Ok, then what? I assume it sets it up for the next part

[attachment=1]issues_2.jpg[/attachment]

2. I need to create a URL for a user to go to. My initial thought is the user logs in, then sees a link to edit their profile. They click the link & it takes them to the edit form. I have reviewed the posts on ReDirect URL & ReDirect User, and the only thing i am certain of is that i need both, in that order.

[attachment=2]issues_1.jpg[/attachment]

I may be doing something wrong, but i feel as though i have followed all the steps i could find & tried many different settings. I have been away from PHP, CF & Joomla for awhile and a lot has changed, so i think i need a lil hand holding. Is there a tutorial i have overlooked or a post that guides you through?

[attachment=0]issues_3.jpg[/attachment]

Thanx in advance!
GreyHead 30 Nov, 2011
Hi ist_04,

I think you can either pass the token in a URL as in your example. Or you can put the data in the form data before the action runs. To do this you can add a Custom Code action, drag it before the DB Record Loader and add
<?php
$user =& JFactory::getUser();
$form->data['token'] = $user->id;
?>

Bob

PS I also have a little Custom action here that loads all the User info for you but it probably isn't worthwhile for this small task.
This topic is locked and no more replies can be posted.