Skip to content

Actions and filters

Gamification: 35 hooks.

Every hook here has a description in the source.

16 actions19 filters

action

davo_achievement_unlock_failed

Fires when an automatic achievement unlock fails.

Evaluation stops here: the stored tier did not change, so checking the next tier would only repeat the same failure.

Parameters of davo_achievement_unlock_failed
ParameterTypeDescription
$user_idintThe user being evaluated.
$achievement_idstringThe achievement group ID.
$errorWP_ErrorThe unlock failure.
add_action
add_action( 'davo_achievement_unlock_failed', 'my_action_callback', 10, 3 );

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

src/domains/gamification/achievements.php:174

filter

davo_claim_once

Filters a request to take a named, expiring claim. A provider answers with true or false; null means no provider answered and the caller falls back to the object cache.

Parameters of davo_claim_once
ParameterTypeDescription
$resultbool|nullWhether the claim was taken. Null when unanswered.
$namestringClaim name.
$ttlintSeconds until the claim expires on its own.

Returns bool|null

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

/**
 * @param bool|null $result
 * @param string $name
 * @param int $ttl
 */
function my_filter_callback( $result, $name, $ttl ) {
	// Change $result as needed, then return it.
	return $result;
}

src/domains/gamification/helpers.php:648

filter

davo_comment_author_id

Resolve a comment's author user ID from its comment ID.

Must be implemented by the Comments domain — see this class's top-of-file docblock for the full contract rationale. Comments are NOT native wp_comments rows — they live in the Comments domain's own custom table — so there is no core WordPress function Gamification can call directly the way get_post_field() works for questions/answers above.

Parameters of davo_comment_author_id
ParameterTypeDescription
$author_idint|nullDefault null. The Comments domain should return the resolved user ID, or leave this as null if it cannot be resolved.
$comment_idintThe comment ID to resolve from.
add_filter
add_filter( 'davo_comment_author_id', 'my_filter_callback', 10, 2 );

/**
 * @param int|null $author_id
 * @param int $comment_id
 */
function my_filter_callback( $author_id, $comment_id ) {
	// Change $author_id as needed, then return it.
	return $author_id;
}

src/domains/gamification/initializer.php:2355

action

davo_content_edited

This action is documented in Questions_Repository::update_question(). Included for comments too, for the same reason comment votes were added to davo_vote_cast: the 'editor' achievement's edit_count stat is meant to track direct edits generically, not just questions/answers.

Passed to callbacks: $editor_id$comment_id'comment'

add_action
add_action( 'davo_content_edited', 'my_action_callback', 10, 3 );

function my_action_callback( $arg1, $arg2, $arg3 ) {
	// Your code here.
}

src/domains/comments/repository.php:400, and 3 more places

filter

davo_gamification_leaderboard_excluded_user_ids

Filter the user IDs that must never appear on a leaderboard.

Parameters of davo_gamification_leaderboard_excluded_user_ids
ParameterTypeDescription
$user_idsint[]Excluded user IDs. Default empty.
add_filter
add_filter( 'davo_gamification_leaderboard_excluded_user_ids', 'my_filter_callback', 10, 1 );

/**
 * @param int[] $user_ids
 */
function my_filter_callback( $user_ids ) {
	// Change $user_ids as needed, then return it.
	return $user_ids;
}

src/domains/gamification/database.php:3001

filter

davo_gamification_log_failures

Filters whether a gamification failure is written to the PHP error log. Defaults to true.

Parameters of davo_gamification_log_failures
ParameterTypeDescription
$logboolWhether to log it.
$messagestringWhat failed.
$contextarray<string, mixed>Facts needed to trace it, such as the user ID and reason.

Returns bool

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

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

src/domains/gamification/helpers.php:698

filter

davo_gamification_public_user_ids

Filter the user IDs allowed in public responses.

Parameters of davo_gamification_public_user_ids
ParameterTypeDescription
$public_idsint[]IDs that have a stats row.
$requestedint[]IDs that were asked about.
add_filter
add_filter( 'davo_gamification_public_user_ids', 'my_filter_callback', 10, 2 );

/**
 * @param int[] $public_ids
 * @param int[] $requested
 */
function my_filter_callback( $public_ids, $requested ) {
	// Change $public_ids as needed, then return it.
	return $public_ids;
}

src/domains/gamification/repository.php:1082

filter

davo_gamification_reputation_action_reference

Filter the built-in reputation actions reference list before it is returned. Third-party plugins granting their own fixed-amount reputation reasons (via REASON_PLUGIN_REWARD or their own registered reason) can append a row here — {reason, label, points} — so it appears in the same reference table.

Parameters of davo_gamification_reputation_action_reference
ParameterTypeDescription
$rowsarray<int, array{reason: string, label: string, points: int}>The reference list.
add_filter
add_filter( 'davo_gamification_reputation_action_reference', 'my_filter_callback', 10, 1 );

/**
 * @param array<int, array{reason: string, label: string, points: int}> $rows
 */
function my_filter_callback( $rows ) {
	// Change $rows as needed, then return it.
	return $rows;
}

src/domains/gamification/helpers.php:830

filter

davo_gamification_reputation_floor

Filter the reputation floor for a specific user.

Returning a negative value here is not supported; the result is clamped to 0 after the filter runs.

Parameters of davo_gamification_reputation_floor
ParameterTypeDescription
$configuredintThe value from Options.
$user_idintThe user ID being evaluated. May be 0.
add_filter
add_filter( 'davo_gamification_reputation_floor', 'my_filter_callback', 10, 2 );

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

src/domains/gamification/helpers.php:737

action

davo_gamification_retention_run

Fires after a retention run.

Parameters of davo_gamification_retention_run
ParameterTypeDescription
$outarray<string, int>Rows removed or compacted per table.
add_action
add_action( 'davo_gamification_retention_run', 'my_action_callback', 10, 1 );

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

src/domains/gamification/repository.php:1403

filter

davo_gamification_summary

Filter the gamification summary object before it is cached and returned.

Parameters of davo_gamification_summary
ParameterTypeDescription
$summaryarray<string, mixed>The assembled summary array.
$user_idintWordPress user ID.
add_filter
add_filter( 'davo_gamification_summary', 'my_filter_callback', 10, 2 );

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

src/domains/gamification/repository.php:483

action

davo_gamification_user_erased

Fires after a user's Gamification data was removed.

Parameters of davo_gamification_user_erased
ParameterTypeDescription
$user_idintWordPress user ID.
$removedarray<string, int>Rows removed per table.
add_action
add_action( 'davo_gamification_user_erased', 'my_action_callback', 10, 2 );

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

src/domains/gamification/repository.php:1176

filter

davo_gamification_weekly_summary_enabled

Filters whether a user receives the Gamification weekly summary.

Parameters of davo_gamification_weekly_summary_enabled
ParameterTypeDescription
$enabledboolDefault: true unless the user unsubscribed.
$user_idintWordPress user ID.
add_filter
add_filter( 'davo_gamification_weekly_summary_enabled', 'my_filter_callback', 10, 2 );

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

src/domains/gamification/initializer.php:3321

action

davo_gamification_write_failed

Fires when a gamification write failed or was rolled back.

Parameters of davo_gamification_write_failed
ParameterTypeDescription
$messagestringWhat failed.
$contextarray<string, mixed>user_id, reason, error code, etc.
add_action
add_action( 'davo_gamification_write_failed', 'my_action_callback', 10, 2 );

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

src/domains/gamification/helpers.php:709

filter

davo_leaderboards

Filter leaderboard entries before they are returned.

Parameters of davo_leaderboards
ParameterTypeDescription
$itemsarray<int, array<string, mixed>>The ranked entries for this page.
$board_slugstringThe board being queried.
$period_keystringThe resolved period key being queried.
add_filter
add_filter( 'davo_leaderboards', 'my_filter_callback', 10, 3 );

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

src/domains/gamification/leaderboards.php:249

filter

davo_level

Filter the displayed level for a user.

The stored level in the database is not modified by this filter. Use this for display-only overrides such as premium level boosts or admin adjustments that should not affect the historical record.

Parameters of davo_level
ParameterTypeDescription
$levelintResolved level number.
$user_idintWordPress user ID.
add_filter
add_filter( 'davo_level', 'my_filter_callback', 10, 2 );

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

src/domains/gamification/experience.php:191

action

davo_moderation_action

Fires after any moderator-level action on a question or answer.

Parameters of davo_moderation_action
ParameterTypeDescription
$moderator_idintModerator user ID.
$object_idintThe content object acted upon.
$action_typestringThe type of moderation action taken.
add_action
add_action( 'davo_moderation_action', 'my_action_callback', 10, 3 );

/**
 * @param int $moderator_id
 * @param int $object_id
 * @param string $action_type
 */
function my_action_callback( $moderator_id, $object_id, $action_type ) {
	// Your code here.
}

src/domains/questions/repository.php:6300, and 1 more place

filter

davo_permissions

Filter the full permission map for a user before it is cached and returned.

Plugins may set individual slugs to true or false to grant or revoke specific permissions regardless of reputation threshold. Unknown slugs added here will also appear in the REST permission summary response.

Parameters of davo_permissions
ParameterTypeDescription
$maparray<string, bool>Slug → bool permission map.
$user_idintWordPress user ID.
add_filter
add_filter( 'davo_permissions', 'my_filter_callback', 10, 2 );

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

src/domains/gamification/permissions.php:111

action

davo_profile_avatar_updated

Fires after a user's avatar has been updated.

Parameters of davo_profile_avatar_updated
ParameterTypeDescription
$user_idintWordPress user ID.
$attachment_idintNew avatar attachment ID.
add_action
add_action( 'davo_profile_avatar_updated', 'my_action_callback', 10, 2 );

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

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

filter

davo_profile_completion_score

Filters a user's profile completion score. Defaults to 0; the Profile domain supplies the real value. Profile milestone achievements unlock as the score passes their thresholds, starting at 50.

Parameters of davo_profile_completion_score
ParameterTypeDescription
$scoreintThe profile completion score.
$user_idintWordPress user ID.

Returns int

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

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

src/domains/gamification/initializer.php:2636

action

davo_profile_cover_updated

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

Parameters of davo_profile_cover_updated
ParameterTypeDescription
$user_idintWordPress user ID.
$attachment_idintNew cover attachment ID.
add_action
add_action( 'davo_profile_cover_updated', 'my_action_callback', 10, 2 );

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

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

action

davo_profile_updated

Fires after a profile has been successfully updated.

Parameters of davo_profile_updated
ParameterTypeDescription
$user_idintWordPress user ID.
$fieldsarray<string, mixed>The fields that were updated.
add_action
add_action( 'davo_profile_updated', 'my_action_callback', 10, 2 );

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

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

action

davo_question_followed

Fires after a user follows a question.

Parameters of davo_question_followed
ParameterTypeDescription
$question_idintPost ID.
$user_idintFollower user ID.
add_action
add_action( 'davo_question_followed', 'my_action_callback', 10, 2 );

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

src/domains/questions/repository.php:5368, and 1 more place

action

davo_question_vote_removed

Fires after a question vote is explicitly removed.

Parameters of davo_question_vote_removed
ParameterTypeDescription
$question_idintPost ID.
$user_idintVoter user ID.
$old_voteintVote value that was removed.
$old_is_freeboolWhether the removed vote was itself cast via the Free Votes weekly allowance.
add_action
add_action( 'davo_question_vote_removed', 'my_action_callback', 10, 4 );

/**
 * @param int $question_id
 * @param int $user_id
 * @param int $old_vote
 * @param bool $old_is_free
 */
function my_action_callback( $question_id, $user_id, $old_vote, $old_is_free ) {
	// Your code here.
}

src/domains/questions/repository.php:5091, and 1 more place

filter

davo_rank

Filter the resolved rank for a user.

The stored reputation is not modified by this filter. Use this for display-only overrides such as admin-assigned honorary ranks or temporary rank grants that should not affect the historical record. Return a complete rank definition array with at minimum 'slug', 'label', 'color', and 'icon' keys.

Parameters of davo_rank
ParameterTypeDescription
$rankarray<string, mixed>Resolved rank definition.
$user_idintWordPress user ID.
add_filter
add_filter( 'davo_rank', 'my_filter_callback', 10, 2 );

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

src/domains/gamification/ranks.php:77

action

davo_release_claim

Fires when a named claim is released, so a shared claim provider can drop it.

Parameters of davo_release_claim
ParameterTypeDescription
$namestringClaim name.
add_action
add_action( 'davo_release_claim', 'my_action_callback', 10, 1 );

/**
 * @param string $name
 */
function my_action_callback( $name ) {
	// Your code here.
}

src/domains/gamification/helpers.php:670

filter

davo_reputation_change

Filter the reputation points before the ledger entry is written.

Returning 0 from this filter makes add() a silent no-op that returns true, so plugins can suppress specific events. Returning a different sign (positive ↔ negative) is allowed and will be reflected in the entry.

Parameters of davo_reputation_change
ParameterTypeDescription
$pointsintPoints change before filtering.
$user_idintUser receiving the reputation change.
$reasonstringReason ID for the change.
add_filter
add_filter( 'davo_reputation_change', 'my_filter_callback', 10, 3 );

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

src/domains/gamification/reputation.php:114

filter

davo_reputation_ledger_entry

Filter the full reputation ledger entry array before it is inserted.

Plugins may add or modify the meta field to attach extra context (e.g. a moderator note, the content title, an IP address).

Parameters of davo_reputation_ledger_entry
ParameterTypeDescription
$entryarray<string, mixed>The entry array about to be inserted.
$user_idintThe recipient user ID.
add_filter
add_filter( 'davo_reputation_ledger_entry', 'my_filter_callback', 10, 2 );

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

src/domains/gamification/reputation.php:142

filter

davo_reputation_reason

Filter the display label for a reputation reason ID.

Third-party plugins should hook here to register labels for their own custom reason IDs.

Parameters of davo_reputation_reason
ParameterTypeDescription
$labelstringResolved label. Falls back to the raw reason ID.
$reason_idstringThe machine-readable reason identifier.
add_filter
add_filter( 'davo_reputation_reason', 'my_filter_callback', 10, 2 );

/**
 * @param string $label
 * @param string $reason_id
 */
function my_filter_callback( $label, $reason_id ) {
	// Change $label as needed, then return it.
	return $label;
}

src/domains/gamification/helpers.php:554

filter

davo_reputation_source_meta

This filter is documented below. */

Passed to callbacks: $meta$source_type$source_id

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

function my_filter_callback( $arg1, $arg2, $arg3 ) {
	// Change $arg1 as needed, then return it.
	return $arg1;
}

src/domains/gamification/helpers.php:864, and 1 more place

action

davo_suggested_edit_accepted

Fires after a suggested edit is approved and successfully applied to its target's live content. This is the signal Gamification's Gamification_Initializer::on_edit_accepted() listens for to grant the suggester their edit-accepted reputation bonus — a distinct reward from the general "editor" achievement/edit_count progress the suggester already gets via davo_content_edited (fired unconditionally by Questions_Repository::apply_question_edit()/ apply_answer_edit() for both direct edits and approve

Parameters of davo_suggested_edit_accepted
ParameterTypeDescription
$suggestion_idintSuggestion ID.
$editor_idintSuggester who authored the accepted edit.
$object_idintQuestion or answer post ID that was edited.
add_action
add_action( 'davo_suggested_edit_accepted', 'my_action_callback', 10, 3 );

/**
 * @param int $suggestion_id
 * @param int $editor_id
 * @param int $object_id
 */
function my_action_callback( $suggestion_id, $editor_id, $object_id ) {
	// Your code here.
}

src/domains/suggested-edits/services/resolver.php:368, and 1 more place

action

davo_suggested_edit_reviewed

Fires after any review is cast (approve or reject), independent of whether it actually resolves the suggestion. Gamification_Initializer::on_suggested_edit_reviewed() listens for this to track the 'reviews_completed' stat/leaderboard — deliberately skipping the increment when $is_author is true, since the target's own author accepting/declining a suggestion on their own content is not the same kind of independent moderation work the "Top Reviewers" leaderboard is meant to recognize. Realtime_Sug

Parameters of davo_suggested_edit_reviewed
ParameterTypeDescription
$suggestion_idintSuggestion ID.
$reviewer_idintUser who cast the review.
$decisionstring'approve' or 'reject'.
$is_authorboolWhether $reviewer_id is the target's own author.
add_action
add_action( 'davo_suggested_edit_reviewed', 'my_action_callback', 10, 4 );

/**
 * @param int $suggestion_id
 * @param int $reviewer_id
 * @param string $decision
 * @param bool $is_author
 */
function my_action_callback( $suggestion_id, $reviewer_id, $decision, $is_author ) {
	// Your code here.
}

src/domains/suggested-edits/services/resolver.php:202, and 1 more place

action

davo_user_logged_in

Fires when a user logs in via WordPress.

Gamification uses this to drive streak tracking and login-based reputation rewards. Other domains may also listen.

Parameters of davo_user_logged_in
ParameterTypeDescription
$user_idintWordPress user ID.
$user_loginstringThe user's login name.
add_action
add_action( 'davo_user_logged_in', 'my_action_callback', 10, 2 );

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

src/domains/gamification/initializer.php:2839

filter

davo_user_statistics

Filter the full statistics object before it is returned.

Parameters of davo_user_statistics
ParameterTypeDescription
$statisticsarray<string, mixed>The assembled statistics array, including any registered custom statistics.
$user_idintWordPress user ID.
add_filter
add_filter( 'davo_user_statistics', 'my_filter_callback', 10, 2 );

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

src/domains/gamification/repository.php:511

action

davo_vote_cast

This action is documented in Questions_Repository::vote_question(). */

Passed to callbacks: $user_id$comment_id'comment'

add_action
add_action( 'davo_vote_cast', 'my_action_callback', 10, 3 );

function my_action_callback( $arg1, $arg2, $arg3 ) {
	// Your code here.
}

src/domains/comments/repository.php:979, and 3 more places

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