Description
This filter can be used to modify a value before it is saved to the user meta.
Usage
add_filter( 'gform_user_registration_meta_value', 'your_function_name', 10, 6 );
Parameters
- $value string
The meta value to be saved.
- $meta_key string
The meta key the value is to be saved for.
- $meta array
The Feed meta or just the mappings from a generic_map type setting.
- $form Form Object
The form currently being processed.
- $entry Entry Object
The entry currently being processed.
- $is_username bool
Indicates if the current field is mapped to the username.
Examples
The following example shows how you can override the site address meta value.
add_filter( 'gform_user_registration_meta_value', function ( $value, $meta_key, $meta, $form, $entry, $is_username ) {
if ( $meta_key == 'siteAddress' ) {
$value = 'your new value';
}
return $value;
}, 10, 6 );
Placement
Your code snippet should be placed in the functions.php file of your active theme.
Since
This filter was added in version 3.0.
Source Code
return apply_filters( 'gform_user_registration_meta_value', $value, $meta_key, $meta, $form, $entry, $is_username );
Since version 5.4 this filter is located in GF_User_Registration::filter_prepared_meta_value()
in class-gf-user-registration.php. It was previously located in GF_User_Registration::get_prepared_value()
.