Custom fields in Gravity Forms form-fields

I created some custom fields to register more information of a user than WP-standard. Next to S2 I use Gravity forms to enable memebers to subscribe to our events. Therefor I want to retrieve content from the S2 Custom Fields and prefill that information in Gravity Form Form-fields.
In Gravity Forms I can use some types of fields; name etc are standard and I can use {user:first_name} to prefill the dedicated field in Gravity. In a HTML-block I can also retrieve and publish via [S2Get user_field=“color-of-my-hair”], but I cannot use this in the other Gravity Field types.
Anyone who can help me?

In the meantime I made some progress. I can publish a literal in the GF-field via a small piece of coding.

add_filter( ‘gform_field_value_streetname-1’, ‘populate_streetname’ );
function populate_streetname( $value ) {
return ‘Angel hill road’;
}

Now this is part of the solution. The other part is to retrieve the custom field content of the logged on user.
someting like: $street=get_user_field(street)

Is such simple item available this way?

Hi Leon,

Maybe this will work for you:
$custom_fields = get_user_option(‘s2member_custom_fields’, $user_id);
$street = $current_user->street;

See: http://s2member.com/kb-article/gettingsetting-custom-registrationprofile-fields-configured-w-s2member/

Thanks all, I just managed it!!!
in my functions.php I added following instruction:

add_filter( ‘gform_field_value_straatnaam’, ‘populate_straatnaam’ );
function populate_straatnaam( $value ) {
$my_straatnaam = get_user_field(‘straatnaam’); # The Unique Field ID you configured with s2Member.
return $my_straatnaam;
}

1 Like