Making WordPress.org

Changeset 12769


Ignore:
Timestamp:
08/01/2023 10:04:38 PM (3 years ago)
Author:
coffee2code
Message:

Photo Directory, Admin: Remove 'Colors' column from the listing of photos in the queue.

Colors are no longer auto-assigned so there's rarely anything to show.

See #7171.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/admin.php

    r12707 r12769  
    3030                add_filter( "manage_{$post_type}_posts_columns",       [ __CLASS__, 'add_flags_column' ] );
    3131                add_action( "manage_{$post_type}_posts_custom_column", [ __CLASS__, 'handle_flags_column_data' ], 10, 2 );
     32                add_filter( "manage_edit-{$post_type}_columns",        [ __CLASS__, 'remove_photo_colors_column' ] );
    3233                add_filter( 'post_row_actions',                        [ __CLASS__, 'add_post_action_photo_links' ], 10, 2 );
    3334                add_filter( 'the_author',                              [ __CLASS__, 'add_published_photos_count_to_author' ] );
     
    325326
    326327                do_action( 'wporg_photos_flag_column_data', $post );
     328        }
     329
     330        /**
     331         * Removes the colors column from the listing of pending photos.
     332         *
     333         * Currently colors aren't auto-assigned, so rarely is there antyhing
     334         * to show.
     335         *
     336         * @param  array $columns Array of post column titles.
     337         * @return array
     338         */
     339        public static function remove_photo_colors_column( $columns ) {
     340                if (
     341                        filter_input( INPUT_GET, 'post_type' ) === Registrations::get_post_type()
     342                &&
     343                        filter_input( INPUT_GET, 'post_status' ) === 'pending'
     344                ) {
     345                        unset( $columns[ 'taxonomy-' . Registrations::get_taxonomy( 'colors' ) ] );
     346                }
     347
     348                return $columns;
    327349        }
    328350
Note: See TracChangeset for help on using the changeset viewer.