Skip to content

Actions and filters

Account: 9 hooks.

Every hook here has a description in the source.

6 actions3 filters

action

davo_account_before_deletion

Fires just before an account is permanently deleted.

Other domains should hook here to clean up their own user data before the WordPress user row is removed. Profile_Initializer also hooks the native 'delete_user' action (which fires inside wp_delete_user()) as a secondary cleanup path for admin-initiated deletions.

Parameters of davo_account_before_deletion
ParameterTypeDescription
$user_idintWordPress user ID about to be deleted.
add_action
add_action( 'davo_account_before_deletion', 'my_action_callback', 10, 1 );

/**
 * @param int $user_id
 */
function my_action_callback( $user_id ) {
	// Your code here.
}

src/domains/account/repository.php:747

action

davo_account_deleted

Fires after an account has been permanently deleted.

Parameters of davo_account_deleted
ParameterTypeDescription
$user_idintThe user ID that was deleted.
$emailstringThe deleted account's email address.
add_action
add_action( 'davo_account_deleted', 'my_action_callback', 10, 2 );

/**
 * @param int $user_id
 * @param string $email
 */
function my_action_callback( $user_id, $email ) {
	// Your code here.
}

src/domains/account/repository.php:779

action

davo_account_deletion_requested

Fires after a deletion confirmation code has been requested (including resends).

Parameters of davo_account_deletion_requested
ParameterTypeDescription
$user_idintWordPress user ID.
add_action
add_action( 'davo_account_deletion_requested', 'my_action_callback', 10, 1 );

/**
 * @param int $user_id
 */
function my_action_callback( $user_id ) {
	// Your code here.
}

src/domains/account/repository.php:681

action

davo_account_email_change_requested

Fires after an email-change verification code has been issued.

Parameters of davo_account_email_change_requested
ParameterTypeDescription
$user_idintWordPress user ID.
$new_emailstringThe pending (unconfirmed) new address.
add_action
add_action( 'davo_account_email_change_requested', 'my_action_callback', 10, 2 );

/**
 * @param int $user_id
 * @param string $new_email
 */
function my_action_callback( $user_id, $new_email ) {
	// Your code here.
}

src/domains/account/repository.php:247

action

davo_account_export_requested

Fires after a personal data export has been requested.

Parameters of davo_account_export_requested
ParameterTypeDescription
$user_idintWordPress user ID.
$request_idintWordPress privacy request ID.
add_action
add_action( 'davo_account_export_requested', 'my_action_callback', 10, 2 );

/**
 * @param int $user_id
 * @param int $request_id
 */
function my_action_callback( $user_id, $request_id ) {
	// Your code here.
}

src/domains/account/repository.php:563

action

davo_account_password_changed

Fires after a user's password has been successfully changed.

Parameters of davo_account_password_changed
ParameterTypeDescription
$user_idintWordPress user ID.
add_action
add_action( 'davo_account_password_changed', 'my_action_callback', 10, 1 );

/**
 * @param int $user_id
 */
function my_action_callback( $user_id ) {
	// Your code here.
}

src/domains/account/repository.php:527

filter

davo_account_self_deletion_allowed

Filters whether an account may delete itself from the account settings. By default only users who cannot edit posts (ordinary members) may.

Parameters of davo_account_self_deletion_allowed
ParameterTypeDescription
$allowedboolWhether self-deletion is allowed.
$user\WP_UserThe account.

Returns bool

add_filter
add_filter( 'davo_account_self_deletion_allowed', 'my_filter_callback', 10, 2 );

/**
 * @param bool $allowed
 * @param \WP_User $user
 */
function my_filter_callback( $allowed, $user ) {
	// Change $allowed as needed, then return it.
	return $allowed;
}

src/domains/account/helpers.php:99

filter

davo_account_settings_template_data

Retrieve the data needed to hydrate the account settings shell.

Profile_Initializer hooks into this filter to provide it — same filter-as-data-provider pattern as davo_profile_template_data, kept consistent even though only one domain currently hooks it.

Parameters of davo_account_settings_template_data
ParameterTypeDescription
$dataarray<string,mixed>|nullNull initially.
$user_idintCurrent user ID.
add_filter
add_filter( 'davo_account_settings_template_data', 'my_filter_callback', 10, 2 );

/**
 * @param array<string,mixed>|null $data
 * @param int $user_id
 */
function my_filter_callback( $data, $user_id ) {
	// Change $data as needed, then return it.
	return $data;
}

src/domains/account/templates/account-settings-page.php:31

filter

davo_profile_settings_sections

Filters the sections shown on the account settings screen. Other domains add theirs here.

Parameters of davo_profile_settings_sections
ParameterTypeDescription
$sectionsarraySections to show. Empty by default.
$user_idintWordPress user ID.

Returns array

add_filter
add_filter( 'davo_profile_settings_sections', 'my_filter_callback', 10, 2 );

/**
 * @param array $sections
 * @param int $user_id
 */
function my_filter_callback( $sections, $user_id ) {
	// Change $sections as needed, then return it.
	return $sections;
}

src/domains/account/initializer.php:274

Note. Generated from the plugin source. Descriptions and parameters are the ones written in the code. The starter code uses the parameter names from those comments, or generic names where there are none, so check them against your use.

See it on your own site.

Davo is a WordPress theme and plugin by Exorex.

  • Runs on your own WordPress
  • Guided setup wizard
  • AI is off until you switch it on
  • Read the licence on the marketplace first