Fires when Groundhogg automatically creates a contact record from a WordPress user registration or login. Use this to apply tags or trigger funnels based on the user’s existing WordPress data.
do_action( 'groundhogg/contact_created_from_user', $user, $contact );
You will receive the WP_User as the first argument and the newly created Contact as the second.
Example
add_action( 'groundhogg/contact_created_from_user', 'my_extension_tag_by_role', 10, 2 );
/**
* Apply a tag based on the WordPress user's role.
*
* @param \WP_User $user
* @param \Groundhogg\Contact $contact
*
* @return void
*/
function my_extension_tag_by_role( $user, $contact ) {
if ( in_array( 'customer', $user->roles ) ) {
$contact->apply_tag( 'woo-customer' );
}
}
Was this helpful?
Let us know if this document answered your question. Thatβs the only way we can improve.
