Pre-Populate Fields Submit Problem

Hi
I am using gravity hooks to set some input automatically. my code is:
`
function get_firstname(){

$current_user = wp_get_current_user();
return $current_user->user_firstname;

}
add_filter( ‘gform_field_value_stuname’,‘get_firstname’,999, 1 );
`
It’s work fine and the “name” field filled automatically.
The problem is that when I submit the form the “name” field will save empty!!
I didn’t find any way to solve this.
Can anyone help me?

For a logged in user, you do not need any code. You can use these user merge tags as “default value” for a field in the form:

This will work to get the first name of the logged in user who submits the form:

{user:first_name}

Thank You
Yes, it’s working but I fetch more data from the database and show it in gravity. I use cimy user extra fields plugin to make some extra field in the registration form and I want to show it in gravity form. so the cimy plugin table is different from other plugins. for example, I wrote this code:

function get_phone_number($value){
    $uid = get_current_user_id();
	global $wpdb, $stdpunm;
	$stdpunm = $wpdb->get_results("SELECT * FROM wp_cimy_uef_data WHERE USER_ID = $uid" );
	return $stdpunm[2]->VALUE;
}
add_filter( 'gform_field_value_stupnumber','get_phone_number');

So i have to use hooks in my forms. any solution?