Filter
uncanny-automator
automator_review_get_sent_emails_count
Filters the count of completed sent emails before it's returned, allowing modification of the total number.
add_filter( 'automator_review_get_sent_emails_count', $callback, 10, 1 );
Description
Filters the count of successfully sent emails. Developers can modify this integer value, allowing for custom reporting or adjustments to the sent email count displayed in the review section. The original value is retrieved from plugin options.
Usage
add_filter( 'automator_review_get_sent_emails_count', 'your_function_name', 10, 1 );
Parameters
-
$this(mixed) - This parameter contains the current count of completed sent emails, defaulting to 0 if no option is set.
Return Value
The filtered value.
Examples
add_filter(
'automator_review_get_sent_emails_count',
/**
* Adjust the sent email count by adding a small bonus for a specific test scenario.
*
* @param int $sent_emails_count The original count of sent emails.
* @param Automator_Review $automator_review_instance The instance of the Automator_Review class.
* @return int The adjusted count of sent emails.
*/
function ( $sent_emails_count, $automator_review_instance ) {
// For demonstration purposes, let's imagine we want to add 10 to the count
// if the current user is aphpunit administrator or if it's a specific testing day.
if ( current_user_can( 'manage_options' ) && defined( 'WP_TESTER' ) ) {
$sent_emails_count += 10;
}
// You could also use the $automator_review_instance object here if needed.
// For example, to check other settings or properties of the review instance.
// if ( method_exists( $automator_review_instance, 'is_debug_mode' ) && $automator_review_instance->is_debug_mode() ) {
// $sent_emails_count = 0; // In debug mode, reset the count for testing.
// }
return $sent_emails_count;
},
10, // Priority
2 // Accepted arguments count
);
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/core/admin/class-automator-review.php:1062
public function get_sent_emails_count() {
return absint( apply_filters( 'automator_review_get_sent_emails_count', automator_get_option( 'automator_sent_email_completed', 0 ), $this ) );
}