From 957acd538e1bd4df976afea020438f42133c1a8b Mon Sep 17 00:00:00 2001 From: Alexander Berthelsen Date: Mon, 14 Dec 2020 15:18:34 +0100 Subject: [PATCH] Fix not being able to create bylines --- bylines.php | 1 - src/Byline_Editor.php | 20 ++------------------ 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/bylines.php b/bylines.php index 6536e1f..065953d 100644 --- a/bylines.php +++ b/bylines.php @@ -55,7 +55,6 @@ function bylines_action_admin_notices_warn_requirements() { // Admin customizations. add_action( 'admin_init', array( 'Bylines\Post_Editor', 'action_admin_init' ) ); add_filter( 'manage_edit-byline_columns', array( 'Bylines\Byline_Editor', 'filter_manage_edit_byline_columns' ) ); -add_filter( 'list_table_primary_column', array( 'Bylines\Byline_Editor', 'filter_list_table_primary_column' ) ); add_filter( 'manage_byline_custom_column', array( 'Bylines\Byline_Editor', 'filter_manage_byline_custom_column' ), 10, 3 ); add_filter( 'user_row_actions', array( 'Bylines\Byline_Editor', 'filter_user_row_actions' ), 10, 2 ); add_action( 'byline_edit_form_fields', array( 'Bylines\Byline_Editor', 'action_byline_edit_form_fields' ) ); diff --git a/src/Byline_Editor.php b/src/Byline_Editor.php index 6896c48..2a44700 100644 --- a/src/Byline_Editor.php +++ b/src/Byline_Editor.php @@ -29,7 +29,7 @@ public static function filter_manage_edit_byline_columns( $columns ) { $new_columns = array(); foreach ( $columns as $key => $title ) { if ( 'name' === $key ) { - $new_columns['byline_name'] = __( 'Name', 'bylines' ); + $new_columns['name'] = $title; $new_columns['byline_user_email'] = __( 'Email', 'bylines' ); } else { $new_columns[ $key ] = $title; @@ -38,15 +38,6 @@ public static function filter_manage_edit_byline_columns( $columns ) { return $new_columns; } - /** - * Set our custom name column as the primary column - * - * @return string - */ - public static function filter_list_table_primary_column() { - return 'byline_name'; - } - /** * Render and return custom column * @@ -55,14 +46,7 @@ public static function filter_list_table_primary_column() { * @param int $term_id Term ID. */ public static function filter_manage_byline_custom_column( $retval, $column_name, $term_id ) { - if ( 'byline_name' === $column_name ) { - $byline = Byline::get_by_term_id( $term_id ); - $avatar = get_avatar( $byline->user_email, 32 ); - // Such hack. Lets us reuse the rendering without duplicate code. - $term = get_term_by( 'id', $term_id, 'byline' ); - $wp_list_table = _get_list_table( 'WP_Terms_List_Table' ); - $retval = $avatar . ' ' . $wp_list_table->column_name( $term ); - } elseif ( 'byline_user_email' === $column_name ) { + if ( 'byline_user_email' === $column_name ) { $byline = Byline::get_by_term_id( $term_id ); if ( $byline->user_email ) { $retval = '' . esc_html( $byline->user_email ) . '';