Multiselect database storage format w/ User Registration Add-On

Hello experts,

I’m using the User Registration Add-On with a multiselect field which is stored in a usermeta field.

When I look at the database the field ist stored like this:

["value1","value2","value3"]

But I’d need it in this format (without brackets and doublequotes):

value1,value2,value3

How could I achieve this?

For your hints many thanks in advance!

Best regards,
David

You can use the following filter to alter the data before saving it to the user meta: gform_user_registration_prepared_value - Gravity Forms

If you’re using an Update User feed, you would need also to use this other filter to change back the data to the original format to allow population of the field mapped: gform_user_registration_user_data_pre_populate - Gravity Forms

Thank you for your reply!

Just a minute before your reply I found another solution using gform_user_registration_meta_value:

add_filter(
	'gform_user_registration_meta_value',
	function ( $value, $meta_key, $meta, $form, $entry, $is_username ) {
		if ( 'my_meta_key' === $meta_key ) {
			$value = str_replace( array( '[', ']', '"' ), '', $value );
		}
		return $value;
	},
	10,
	6
);

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.