Skip to content

Actions and filters

Article section feedback: 4 hooks.

Every hook here has a description in the source.

3 actions1 filter

filter

davo_article_feedback_allowed

Filters whether a user may submit feedback on a section of an article. The Articles domain answers this; it stays true when nothing answers.

Parameters of davo_article_feedback_allowed
ParameterTypeDescription
$allowedboolWhether the feedback may be submitted. Default true.
$post_idintArticle post ID.
$user_idintUser ID, or 0 for a guest.

Returns bool

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

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

src/domains/article-section-feedback/repository.php:72, and 2 more places

action

davo_article_section_feedback_created

Fires after a new section feedback entry is created.

Parameters of davo_article_section_feedback_created
ParameterTypeDescription
$post_idintPost ID.
$reasonstringFeedback reason key.
$section_contentstringSerialized section content.
$user_idint|nullUser ID or null for visitors.
add_action
add_action( 'davo_article_section_feedback_created', 'my_action_callback', 10, 4 );

/**
 * @param int $post_id
 * @param string $reason
 * @param string $section_content
 * @param int|null $user_id
 */
function my_action_callback( $post_id, $reason, $section_content, $user_id ) {
	// Your code here.
}

src/domains/article-section-feedback/repository.php:131

action

davo_article_section_feedback_deleted

Fires after a section feedback entry is deleted.

Parameters of davo_article_section_feedback_deleted
ParameterTypeDescription
$idintRow ID.
$post_idintPost ID.
add_action
add_action( 'davo_article_section_feedback_deleted', 'my_action_callback', 10, 2 );

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

src/domains/article-section-feedback/repository.php:223

action

davo_article_section_feedback_status_updated

Fires after a section feedback status is updated.

Parameters of davo_article_section_feedback_status_updated
ParameterTypeDescription
$idintRow ID.
$statusstringNew status.
add_action
add_action( 'davo_article_section_feedback_status_updated', 'my_action_callback', 10, 2 );

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

src/domains/article-section-feedback/repository.php:183

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