Skip to content

Commit

Permalink
Hide records from disabled connectors on list table
Browse files Browse the repository at this point in the history
Introduce 'wp_stream_list_table_hide_disabled_connectors_records' filter
  • Loading branch information
Dzikri Aziz committed Feb 19, 2014
1 parent fbcd9f0 commit 7713e61
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions includes/list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,25 @@ function get_records() {
}
$args['paged'] = $this->get_pagenum();

// Exclude disabled connectors
if ( empty( $args['connector'] ) ) {
/**
* Toggle visibility of records from disabled connectors on list table
*
* @param bool $hidden Visibility status, hidden by default.
*/
$hide_disabled_connectors_records = apply_filters( 'wp_stream_list_table_hide_disabled_connectors_records', true );

if ( true === $hide_disabled_connectors_records ) {
$args['connector__in'] = wp_list_filter(
WP_Stream_Settings::$options['connectors_active_connectors'],
array( '__placeholder__' ),
'NOT'
);
}
}


if ( ! isset( $args['records_per_page'] ) ) {
$args['records_per_page'] = $this->get_items_per_page( 'edit_stream_per_page', 20 );
}
Expand Down

0 comments on commit 7713e61

Please sign in to comment.