wpf_user_update

Overview

This filter allows you to modify user meta data before it’s sent to 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, in the format array('meta_field' => 'value').
  • $user_id: ID for the user being updated.

Examples

Save the full URL to a user’s profile photo

If you’re using Ultimate Member to run your site’s membership platform, and want to save a link to the user’s profile photo in your CRM, you’ll find that just syncing the profile_photo field gives you the name of the file, but not the full URL. Using wpf_user_update, we can modify this so the full URL to the user’s profile is sent.

add_filter('wpf_user_update', 'set_profile_photo_url', 10, 2);

function set_profile_photo_url($user_meta, $user_id) {
	
	// Changes "profile_photo.png" to "http://mysite.com/wp-content/uploads/ultimatemember/1/profile_photo.png"
	if(isset($user_meta['profile_photo']))
		$user_meta['profile_photo'] = content_url() . '/uploads/ultimatemember/' . $user_id . '/' . $user_meta['profile_photo'];

	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_update for your site contact us and we’d be happy to help.