User registration - change the 'created by' field to new user

When the Gravity Forms User Registration Add-On creates a new user account the entry's 'created by' field is left as the anonymous IP address. This can affect the configuration of the workflow emails. The following snippet will set the 'created by' field to the id of the newly created user account.

add_action("gform_user_registered", "sh_gform_user_registered", 10, 4);
function sh_gform_user_registered($user_id, $config, $entry, $user_pass) {    
    GFAPI::update_entry_property( $entry['id'], 'created_by', $user_id );
}

Still need help? Contact Support Contact Support