diff --git a/php/class-coauthors-guest-authors.php b/php/class-coauthors-guest-authors.php index 3c351884..2dd1678e 100644 --- a/php/class-coauthors-guest-authors.php +++ b/php/class-coauthors-guest-authors.php @@ -463,13 +463,34 @@ function view_guest_authors_list() { wp_die( esc_html( sprintf( __( "%s can't be deleted because it doesn't exist.", 'co-authors-plus' ), $this->labels['singular'] ) ) ); } + // get post count + global $coauthors_plus; + $term = $coauthors_plus->get_author_term( $guest_author ); + if ( $term ) { + $count = $term->count; + } else { + $count = 0; + } + echo '
' . esc_html( sprintf( __( 'You have specified this %s for deletion:', 'co-authors-plus' ), strtolower( $this->labels['singular'] ) ) ) . '
'; echo '#' . esc_html( $guest_author->ID . ': ' . $guest_author->display_name ) . '
'; - echo '' . esc_html( sprintf( __( 'What should be done with posts assigned to this %s?', 'co-authors-plus' ), strtolower( $this->labels['singular'] ) ) ) . '
'; - echo '' . esc_html( sprintf( __( "Note: If you'd like to delete the %s and all of their posts, you should delete their posts first and then come back to delete the %s.", 'co-authors-plus' ), strtolower( $this->labels['singular'] ), strtolower( $this->labels['singular'] ) ) ) . '
'; + + if ( $count === 0 ) { + $post_count_message = '' . esc_html( sprintf( __( 'There are %d posts associated with this guest author.', 'co-authors-plus' ), $count, strtolower( $this->labels['singular'] ) ) ) . '
'; + } + else if ( $count === 1 ) { + $post_count_message = '' . esc_html( sprintf( __( 'There is %d post associated with this guest author. What should be done with the post assigned to this %s?', 'co-authors-plus' ), $count, strtolower( $this->labels['singular'] ) ) ) . '
'; + } + else { + $post_count_message = '' . esc_html( sprintf( __( 'There are %d posts associated with this guest author. What should be done with the posts assigned to this %s?', 'co-authors-plus' ), $count, strtolower( $this->labels['singular'] ) ) ) . '
'; + } + echo $post_count_message; + if ( $count > 0 ) { + echo '' . esc_html( sprintf( __( "Note: If you'd like to delete the %s and all of their posts, you should delete their posts first and then come back to delete the %s.", 'co-authors-plus' ), strtolower( $this->labels['singular'] ), strtolower( $this->labels['singular'] ) ) ) . '
'; + } echo ''; echo '