Fires when the assigned owner of a contact is changed.
do_action( 'groundhogg/contact/owner_changed', $owner, $contact, $prev_owner );
You will receive the new owner WP_User, the Contact object, and the previous owner WP_User as arguments.
Example
add_action( 'groundhogg/contact/owner_changed', 'my_extension_notify_new_owner', 10, 3 );
/**
* Email the new owner when a contact is reassigned.
*
* @param \WP_User $owner
* @param \Groundhogg\Contact $contact
* @param \WP_User $prev_owner
*
* @return void
*/
function my_extension_notify_new_owner( $owner, $contact, $prev_owner ) {
\Groundhogg\gh_mail(
$owner->user_email,
'A contact has been assigned to you',
sprintf(
'%s (%s) has been transferred to you from %s.',
$contact->get_full_name(),
$contact->get_email(),
$prev_owner->display_name
)
);
}
Was this helpful?
Let us know if this document answered your question. Thatβs the only way we can improve.
