Filter data not synced
-
Hi,
I have several filters applied to user data on new user and update user. However, WP Fusion is not syncing the filtered data, rather the raw submitted form data. I debugged to trace the process and confirmed 1) the filters are being applied correctly and 2) the meta data is saving to database, prior to the execution of the WP Fusion sync functions.
Here are two WordPress core filters (wp-includes/user.php:wp_insert_user()):
1715: apply_filters( ‘pre_user_first_name’, $first_name )
1726: apply_filters( ‘pre_user_last_name’, $last_name )https://developer.www.ads-software.com/reference/hooks/pre_user_first_name/
https://developer.www.ads-software.com/reference/hooks/pre_user_last_name/(I have also tested with a third-party user profile plugin and associated filters, but for the sake of this example I opted to use core filters as to show there is not a plugin conflict/error. WP Fusion also ignores the user data filtered and syncs the unfiltered form $REQUEST or $POST data instead.)
To recreate the issue:
1) Add a filter to the functions file (or elsewhere). This is mine:
function format_first_name($first_name) {
$first_name = (ctype_upper(str_replace(‘ ‘, ”, $first_name)) ? ucwords(strtolower($first_name)) : ucwords($first_name));
return $first_name;
}
add_filter(‘pre_user_first_name’, ‘format_first_name’, 10, 1);2) Edit a user, changing the value of the First Name (bob) and Last Name (jones) to all lowercase, e.g. bob jones.
3) Save the user.
4) Check WP Fusion log (and confirm in CRM).Actual Result: first_name and last_name data synced matches the raw form data submitted, e.g. bob jones.
Expected Result: first_name and last_name are filtered (per example #1) to apply uppercase to first letter of names, e.g. Bob Jones.
You can use any filter, this is my real world example: formatting poorly typed names.
** The same issue occurs with user_email using raw form data rather than filtered.
For this use case, I am syncing to HubSpot but I believe this affects all contact sync integrations per includes/class-user.php:profile_update():257.
For purposes of this debug, I focused on updating existing users but the issue also occurs with creating new users.
- The topic ‘Filter data not synced’ is closed to new replies.