wpf_user_updated

#Overview

This action is triggered whenever updated meta data is loaded from a CRM contact record for a user.

#Parameters

  • $user_id: The user ID
  • $user_meta: An array of meta fields loaded from the CRM

#Examples

#Update a user’s role based on the value of a custom field

function my_set_custom_role( $user_id, $user_meta ) {
	

	if ( 'Active' == $user_meta['custom_field_key'] ) {

		$user = new WP_User( $user_id );
		$user->set_role( 'active-role' );

	}


}

add_action( 'wpf_user_updated', 'my_set_custom_role', 10, 2 );

#Was this helpful?