Skip to content

Actions and filters

Profile: 15 hooks.

Every hook here has a description in the source.

5 actions10 filters

action

davo_profile_avatar_deleted

Fires after a user's avatar has been deleted.

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

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

src/domains/profile/repository.php:1059

filter

davo_profile_can_manage_avatar

Filters whether the current user may change another user's avatar.

Only consulted when the current user is neither the owner nor a site admin.

Parameters of davo_profile_can_manage_avatar
ParameterTypeDescription
$can_manageboolWhether the change is allowed. Default false.
$target_user_idintUser whose avatar would change.
$current_userintUser making the request.
add_filter
add_filter( 'davo_profile_can_manage_avatar', 'my_filter_callback', 10, 3 );

/**
 * @param bool $can_manage
 * @param int $target_user_id
 * @param int $current_user
 */
function my_filter_callback( $can_manage, $target_user_id, $current_user ) {
	// Change $can_manage as needed, then return it.
	return $can_manage;
}

src/domains/profile/routes.php:496, and 1 more place

filter

davo_profile_completion_fields

Filter the field/weight pairs used to compute the profile completion score.

Each element must be a two-element array: [ field_key (string), weight (int) ]. avatar is a virtual key checked against $avatar_id, not a real profile key.

Parameters of davo_profile_completion_fields
ParameterTypeDescription
$fieldsarray<array{string, int}>Default field/weight pairs.
$profilearray<string, mixed>Raw profile array.
$avatar_idintAvatar attachment ID.
add_filter
add_filter( 'davo_profile_completion_fields', 'my_filter_callback', 10, 3 );

/**
 * @param array<array{string, int}> $fields
 * @param array<string, mixed> $profile
 * @param int $avatar_id
 */
function my_filter_callback( $fields, $profile, $avatar_id ) {
	// Change $fields as needed, then return it.
	return $fields;
}

src/domains/profile/helpers.php:510

action

davo_profile_cover_deleted

Fires after a user's cover image has been deleted.

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

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

src/domains/profile/repository.php:1127

filter

davo_profile_data

Filter the full profile response before it is returned.

Parameters of davo_profile_data
ParameterTypeDescription
$profilearray<string, mixed>Profile data array.
$user_idintProfile owner user ID.
$viewing_user_idintViewing user ID (0 = guest).
add_filter
add_filter( 'davo_profile_data', 'my_filter_callback', 10, 3 );

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

src/domains/profile/repository.php:660

filter

davo_profile_initial_activity

Hydrate registry-public activity through the Activity read service.

Parameters of davo_profile_initial_activity
ParameterTypeDescription
$timelinearray|nullFirst page or null when unavailable.
$user_idintProfile author.
$sectionstringRequested section.
$viewer_idintCurrent viewer; the public visibility constraint remains enforced.
add_filter
add_filter( 'davo_profile_initial_activity', 'my_filter_callback', 10, 4 );

/**
 * @param array|null $timeline
 * @param int $user_id
 * @param string $section
 * @param int $viewer_id
 */
function my_filter_callback( $timeline, $user_id, $section, $viewer_id ) {
	// Change $timeline as needed, then return it.
	return $timeline;
}

src/domains/profile/initializer.php:685

filter

davo_profile_initial_content

Read author content through its owning domain, with guest visibility for public attribution.

Parameters of davo_profile_initial_content
ParameterTypeDescription
$contentarray|nullPrepared author page.
$user_idintProfile author.
$kindstringResource kind.
$viewer_idintGuest viewer (0).
$pageintPage number, defaulting to 1 for template hydration.
add_filter
add_filter( 'davo_profile_initial_content', 'my_filter_callback', 10, 5 );

/**
 * @param array|null $content
 * @param int $user_id
 * @param string $kind
 * @param int $viewer_id
 * @param int $page
 */
function my_filter_callback( $content, $user_id, $kind, $viewer_id, $page ) {
	// Change $content as needed, then return it.
	return $content;
}

src/domains/profile/repository.php:114, and 1 more place

filter

davo_profile_nav_items

Filters the navigation items shown on a member profile. Items are sorted by their order value.

Parameters of davo_profile_nav_items
ParameterTypeDescription
$itemsarray<int, array<string, mixed>>Navigation items. Empty by default.
$user_idintThe profile owner's user ID.
$viewing_user_idintThe viewing user's ID.

Returns array<int, array<string, mixed>>

add_filter
add_filter( 'davo_profile_nav_items', 'my_filter_callback', 10, 3 );

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

src/domains/profile/repository.php:648

action

davo_profile_nicename_sync_failed

Fires when syncing user_nicename to a newly changed Davo slug fails. The Davo slug change itself has already succeeded.

Parameters of davo_profile_nicename_sync_failed
ParameterTypeDescription
$user_idintWordPress user ID.
$slugstringThe slug that failed to sync.
$errorWP_ErrorThe resulting error from wp_update_user().
add_action
add_action( 'davo_profile_nicename_sync_failed', 'my_action_callback', 10, 3 );

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

src/domains/profile/repository.php:448

filter

davo_profile_page_title

Filters the browser tab title of a member profile page. Defaults to the member's display name followed by "Member Profile".

Parameters of davo_profile_page_title
ParameterTypeDescription
$titlestringPage title.
$profilearray<string, mixed>The profile being shown.

Returns string

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

/**
 * @param string $title
 * @param array<string, mixed> $profile
 */
function my_filter_callback( $title, $profile ) {
	// Change $title as needed, then return it.
	return $title;
}

src/domains/profile/templates/profile-page.php:69

action

davo_profile_save_extra

Fires so additional profile answers validated above can be stored.

Parameters of davo_profile_save_extra
ParameterTypeDescription
$user_idintProfile owner.
$validated_extraarray<string, mixed>Payload returned by davo_profile_validate_extra.
add_action
add_action( 'davo_profile_save_extra', 'my_action_callback', 10, 2 );

/**
 * @param int $user_id
 * @param array<string, mixed> $validated_extra
 */
function my_action_callback( $user_id, $validated_extra ) {
	// Your code here.
}

src/domains/profile/repository.php:893

action

davo_profile_slug_changed

Fires after a user's profile slug has been successfully changed.

Parameters of davo_profile_slug_changed
ParameterTypeDescription
$user_idintWordPress user ID.
$new_slugstringThe newly active slug.
$old_slugstringThe previous active slug, or empty string.
add_action
add_action( 'davo_profile_slug_changed', 'my_action_callback', 10, 3 );

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

src/domains/profile/repository.php:458

filter

davo_profile_stats

Filter the profile stats for a user.

Other domains hook here to contribute their own content counts. Do NOT add persistent caching inside this hook — the outer get_stats() call already caches the assembled result.

Parameters of davo_profile_stats
ParameterTypeDescription
$statsarray<string, int>Current stats array.
$user_idintWordPress user ID.
add_filter
add_filter( 'davo_profile_stats', 'my_filter_callback', 10, 2 );

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

src/domains/profile/repository.php:1179

filter

davo_profile_template_data

Retrieve the resolved profile data for the current slug.

The Profile_Initializer hooks into this filter to provide the data. Returns null when the slug results in a 404 (the redirect case is handled earlier in template_redirect — by the time we arrive here the slug is always current).

Parameters of davo_profile_template_data
ParameterTypeDescription
$dataarray<string,mixed>|nullNull initially.
$slugstringProfile slug from the URL.
add_filter
add_filter( 'davo_profile_template_data', 'my_filter_callback', 10, 2 );

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

src/domains/profile/templates/profile-page.php:37

filter

davo_profile_validate_extra

Validates additional profile answers (for example custom profile fields) before anything is written. Return the validated payload, or a WP_Error to refuse the update.

Parameters of davo_profile_validate_extra
ParameterTypeDescription
$validatedarray<string, mixed>Validated payload so far.
$user_idintProfile owner.
$extraarray<string, mixed>Raw additional answers.
$actor_idintUser making the change.
add_filter
add_filter( 'davo_profile_validate_extra', 'my_filter_callback', 10, 4 );

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

src/domains/profile/repository.php:761

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