Fires when a brand-new contact record is created via Contact::create(). At this point the contact exists in the database, its locale has been set, and consent data has been handled.
do_action( 'groundhogg/contact/created', $contact );
You will receive the newly created Contact object.
Example
add_action( 'groundhogg/contact/created', 'my_extension_sync_new_contact' );
/**
* Push a new contact to an external CRM when they are created.
*
* @param \Groundhogg\Contact $contact
*
* @return void
*/
function my_extension_sync_new_contact( $contact ) {
my_extension_api_request( 'POST', '/contacts', [
'email' => $contact->get_email(),
'first_name' => $contact->get_first_name(),
'last_name' => $contact->get_last_name(),
] );
}
Was this helpful?
Let us know if this document answered your question. Thatβs the only way we can improve.
