Generates a personalised email confirmation URL for a contact. When clicked, the contact’s opt-in status is updated to confirmed. The URL includes a permissions key and failsafe tracking parameters. Filterable via groundhogg/confirmation_url.
Parameters
| Parameter | Type | Description |
|---|---|---|
$contact | Contact | The contact to generate the confirmation URL for. |
Return value
string — The full confirmation URL with permissions key.
Usage
$url = \Groundhogg\confirmation_url( $contact );
echo 'Confirm your email address';
Example
add_action( 'groundhogg/contact/created', 'my_plugin_send_custom_confirmation' );
/**
* Send a branded confirmation email when a contact is created.
*
* @param \Groundhogg\Contact $contact
*
* @return void
*/
function my_plugin_send_custom_confirmation( $contact ) {
$url = \Groundhogg\confirmation_url( $contact );
\Groundhogg\gh_mail(
$contact->get_email(),
'Please confirm your email address',
'
Hi ' . esc_html( $contact->get_first_name() ) . ',
'
. '
Click here to confirm your email.
',
[ 'Content-Type: text/html; charset=UTF-8' ]
);
}
Was this helpful?
Let us know if this document answered your question. That’s the only way we can improve.
