wpf_user_register

Overview

This filter allows you to modify any user meta data captured at registration, before a new contact record is created in your crm. To use the code examples below, add them to your active theme’s functions.php file.

Parameters

  • $user_meta: Array of user meta data collected at registration, in the format array('meta_field' => 'value').
  • $user_id: ID for the user being updated.

Examples

Correct an invalid input field name on a registration form

Some plugins allow you to add custom fields to registration forms via code, but the “name” value of the input isn’t the same as the meta field in the database. For example, you may have added the field my_custom_field to the form, but in the database (and WP Fusion’s Contact Fields settings) the field is myplugin_my_custom_field. Since WP Fusion is looking for the meta key value as it’s set in the database, it won’t be detected on the registration form.

To correct this, you can use the wpf_user_register filter like so:

add_filter('wpf_user_register', 'my_wpf_filter_registration', 10, 2);

function my_wpf_filter_registration($user_meta, $user_id) {
	
	if(isset($user_meta['my_custom_field']))
		$user_meta['myplugin_my_custom_field'] = $user_meta['my_custom_field'];

	return $user_meta;

}

This filter can be used in a wide variety of ways depending on your particular site’s configuration. For assistance in configuring wpf_user_register for your site contact us and we’d be happy to help.