Forums

Load user info [GH] action help

Wudaben 06 Dec, 2012
I am trying to use a variable in my form from the User Profile plugin and am using the "Load user info [GH] action to attempt to accomplish this but am having some difficulties. I can successfully call any info that is directly mapped to a variable but how do I go about loading a data field from the user profile array?

The information I am attempting to access is the user's address information, address1, city, region, etc.

Thanks for any assistance you can provide!
GreyHead 06 Dec, 2012
Hi Wudaben,

You should be able to do it by using for example: $form->data['cfu_profile']['city'] or {cfu_profile.city} depending on the context.

Bob
Wudaben 06 Dec, 2012
Ok, right now I've just got a test form that I'm using and I'm using custom coding. If I simply have an area of plain text and I enter {cfu_user} or {cfu_profile.city} then the data shows up properly in my visible form when I load it but when I try to use those entries in the value of a form I do not get any data returned. At this point I'm just trying to load the form to see the results and I haven't even attempted to submit the form.

If I use the {cfu_user} element inside the form like this it works:

<input type="text" name="test1" size="30" value="{cfu_name}" />


but if I try to use the {cfu_profile.city} element like this it does not show me the data:

<input type="text" name="test1" size="30" value="{cfu_profile.city}" />


I am not exactly sure how the other example is supposed to be used but I've tried it in each of the following ways with no luck:

<input type="text" name="test3" size="30" value="$form->data['cfu_profile']['city']" />

<input type="text" name="test4" size="30" value="<?php $form->data['cfu_profile']['city'] ?>" />
GreyHead 06 Dec, 2012
Hi Wudaben,

You have two choices to set the values: you can either set the input name to match the data:
<input type="text" name="cfu_profile[city]" size="30" value="" />
or you can use a Custom code action to move the data around the $form->data[] array to match your names:
<?php
$form->data['test1'] = $form->data['cfu_profile']['city'];
?>

In either case the ChronoForms republisher will set the values for you.

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