groundhogg/preferences/erase_profile

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Action Hooks

Β»

groundhogg/preferences/erase_profile

Fires when a contact requests erasure of their personal data from the preferences page. Use this to delete your extension’s data for that contact.

do_action( 'groundhogg/preferences/erase_profile', $contact );

You will receive the Contact object.

Example

add_action( 'groundhogg/preferences/erase_profile', 'my_extension_erase_data' );

/**
 * Delete all extension data when a contact requests erasure.
 *
 * @param \Groundhogg\Contact $contact
 *
 * @return void
 */
function my_extension_erase_data( $contact ) {
    global $wpdb;

    $wpdb->delete(
        $wpdb->prefix . 'my_extension_data',
        [ 'contact_id' => $contact->get_id() ],
        [ '%d' ]
    );
}

Was this helpful?

Let us know if this document answered your question. That’s the only way we can improve.