Delete a reported Davo comment — a "Delete Content" admin action from the Reports queue. Comments_Initializer hooks this, same delegation pattern as davo_report_target_exists_comment/ davo_report_target_author_comment/ davo_report_target_title_comment/ davo_report_target_url_comment above: this app's own comments are a completely separate table from native wp_comments, and Reports takes no direct dependency on the Comments domain.
Parameters of davo_report_action_delete_target_comment
Parameter
Type
Description
$deleted
bool
Whether the comment was deleted. Default false (no domain has hooked this).
$target_id
int
Comment ID.
add_filter
add_filter( 'davo_report_action_delete_target_comment', 'my_filter_callback', 10, 2 );
/**
* @param bool $deleted
* @param int $target_id
*/functionmy_filter_callback( $deleted, $target_id ) {
// Change $deleted as needed, then return it.return$deleted;
}
The report's own reporter — captured from $existing before the row was deleted above, since the row (and so its reporter_user_id) is no longer queryable by the time this fires.
add_action
add_action( 'davo_report_deleted', 'my_action_callback', 10, 3 );
/**
* @param int $report_id
* @param int $admin_id
* @param int $reporter_user_id
*/functionmy_action_callback( $report_id, $admin_id, $reporter_user_id ) {
// Your code here.
}
Filter the WordPress REST object types the davo_reports field is attached to. Defaults to the three built-in types Reports itself understands directly.
Reports has no built-in knowledge of any other domain's custom post types by design. A domain that wants davo_reports exposed on its own custom post type's default REST response should add its post type slug via this filter from its own initializer, for example: add_filter( 'davo_report_rest_field_object_types', function ( array $types ): array { $types[] = Questions_Helpers::POST_TYPE_QUESTION; $types[] = Questions_Helpers::POST_TYPE_ANSWER; return $types; } ); Any post type added here is automatically bucketed under Reports' own TARGET_POST target type by resolve_target_type() below — Reports' target_type enum only distinguishes post/comment/user, not individual post types, since get_post() already resolves any post type generically.
The report's own reporter — included so a listener can address a reporter-scoped destination (e.g. a realtime channel) without a second lookup back to this row.
add_action
add_action( 'davo_report_status_updated', 'my_action_callback', 10, 5 );
/**
* @param int $report_id
* @param string $old_status
* @param string $new_status
* @param int $admin_id
* @param int $reporter_user_id
*/functionmy_action_callback( $report_id, $old_status, $new_status, $admin_id, $reporter_user_id ) {
// Your code here.
}
src/domains/reports/repository.php:1165, and 2 more places
Mirrors davo_report_target_exists_comment — lets the Comments domain (or any other non-native comment-shaped domain) resolve the author of its own comment IDs so self-report blocking works for them too. Only consulted when the native lookup above didn't resolve an author.
Parameters of davo_report_target_author_comment
Parameter
Type
Description
$author_id
int
Author user ID resolved so far (0 = unresolved).
$target_id
int
Comment ID.
add_filter
add_filter( 'davo_report_target_author_comment', 'my_filter_callback', 10, 2 );
/**
* @param int $author_id
* @param int $target_id
*/functionmy_filter_callback( $author_id, $target_id ) {
// Change $author_id as needed, then return it.return$author_id;
}
Let other comment-shaped domains (notably this app's own Comments domain, whose davo_comments table is entirely separate from wp_comments) resolve their own IDs. See the "A NOTE ON TARGET_COMMENT" docblock on Reports_Helpers::VALID_TARGET_TYPES for the full rationale.
Parameters of davo_report_target_exists_comment
Parameter
Type
Description
$exists
bool
Whether a native WP comment with this ID was found.
$target_id
int
Comment ID being validated.
add_filter
add_filter( 'davo_report_target_exists_comment', 'my_filter_callback', 10, 2 );
/**
* @param bool $exists
* @param int $target_id
*/functionmy_filter_callback( $exists, $target_id ) {
// Change $exists as needed, then return it.return$exists;
}
src/domains/reports/repository.php:1705, and 3 more places
Resolve a comment's display title, for the "My Reports" page. Comments_Initializer hooks this to return e.g. a truncated excerpt of the comment content.
Parameters of davo_report_target_title_comment
Parameter
Type
Description
$default
string
Default title (empty string = unresolved).
$target_id
int
Comment ID.
add_filter
add_filter( 'davo_report_target_title_comment', 'my_filter_callback', 10, 2 );
/**
* @param string $default
* @param int $target_id
*/functionmy_filter_callback( $default, $target_id ) {
// Change $default as needed, then return it.return$default;
}
Override the resolved title for a "My Reports" row whose target is a WordPress post. Default is get_the_title(), or the "Reply to: …" fallback above when that's empty.
Override the resolved URL for a "My Reports" row whose target is a WordPress post. Default is get_permalink(), which resolves to nothing useful for a post type registered with publicly_queryable => false (e.g. this app's own answers) — a domain in that situation should hook this to point somewhere real instead.
Fires after a reporter withdraws their own report.
Parameters of davo_report_withdrawn
Parameter
Type
Description
$report_id
int
Withdrawn report ID.
$user_id
int
Reporter who withdrew it.
add_action
add_action( 'davo_report_withdrawn', 'my_action_callback', 10, 2 );
/**
* @param int $report_id
* @param int $user_id
*/functionmy_action_callback( $report_id, $user_id ) {
// Your code here.
}
src/domains/reports/repository.php:948
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.