/**
  * Render display name, e.g. author name
  */
 function column_display_name($item)
 {
     $item_edit_link = get_edit_post_link($item->ID);
     $args = array('action' => 'delete', 'id' => $item->ID, '_wpnonce' => wp_create_nonce('guest-author-delete'));
     $item_delete_link = add_query_arg($args, menu_page_url('view-guest-authors', false));
     $item_view_link = get_author_posts_url($item->ID, $item->user_nicename);
     $output = '';
     $output .= coauthors_get_avatar($item, 32);
     if (current_user_can('edit_post', $item->ID)) {
         $output .= '<a href="' . esc_url($item_edit_link) . '">' . esc_html($item->display_name) . '</a>';
     } else {
         $output .= esc_html($item->display_name);
     }
     $actions = array();
     if (current_user_can('edit_post', $item->ID)) {
         $actions['edit'] = '<a href="' . esc_url($item_edit_link) . '">' . __('Edit', 'co-authors-plus') . '</a>';
     }
     if (current_user_can('delete_post', $item->ID)) {
         $actions['delete'] = '<a href="' . esc_url($item_delete_link) . '">' . __('Delete', 'co-authors-plus') . '</a>';
     }
     $actions['view'] = '<a href="' . esc_url($item_view_link) . '">' . __('View Posts', 'co-authors-plus') . '</a>';
     $actions = apply_filters('coauthors_guest_author_row_actions', $actions, $item);
     $output .= $this->row_actions($actions, false);
     return $output;
 }
    return get_author_posts_url($authors->ID, $authors->user_nicename);
}, 10, 3);
/**
 * Change the avatar to be the avatar of the first author
 *
 * @param $author_avatar
 * @param $post_id
 * @param $authors
 *
 * @return string with the html for the avatar
 */
add_filter('wpcom_subscriber_email_author_avatar', function ($author_avatar, $post_id, $authors) {
    if (is_array($authors)) {
        return coauthors_get_avatar($authors[0], 50);
    }
    return coauthors_get_avatar($authors, 50);
}, 10, 3);
/**
 * Changes the author byline in the subscription email to include all the authors of the post
 *
 * @param $author_byline
 * @param $post_id
 * @param $authors
 *
 * @return string with the byline html
 */
add_filter('wpcom_subscriber_email_author_byline_html', function ($author_byline, $post_id, $authors) {
    // Check if $authors is a valid array
    if (!is_array($authors)) {
        $authors = array($authors);
    }