Skip to main content

List the account emails that belong to no show

Free Intermediate

Some email is about a WordPress account, not a show: confirming an address, setting a password. Its log rows carry no show. Pass show_id => 0 to benecaster_get_email_log() and benecaster_count_email_log() to read exactly those, without reading every show’s mail.

Code

<?php
function my_addon_account_emails( int $page = 1 ): array {
    if ( ! current_user_can( 'manage_options' ) ) {
        return [ 'rows' => [], 'total' => 0 ];
    }

    $filters = [ 'show_id' => 0 ]; // 0 = no show. Leave show_id out to mean every show.

    return [
        'rows'  => benecaster_get_email_log( $filters + [ 'limit' => 50, 'offset' => ( $page - 1 ) * 50 ] ),
        'total' => benecaster_count_email_log( $filters ),
    ];
}

View on GitHub →

Need this built rather than just documented? See our services →