Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Tom Irons Posted March 19, 2016 Posted March 19, 2016 I'm trying to exclude a list of forums from showing up in streams, What I've found so far was to hook into \IPS\Content\Search\Mysql\Query and change the filterByContent method. So far this is what I've got: public function filterByContent( array $contentFilters, $type = TRUE ) { parent::filterByContent( $contentFilters, $type ); $params = []; if ( \IPS\Dispatcher::i()->controller == 'streams' ) { $where = []; foreach ( $contentFilters as $filter ) { $app = explode( '\\', $filter->itemClass )[1]; if ( in_array( $app, ['blog', 'cms', 'downloads', 'forums', 'gallery'] ) ) { $where[] = \IPS\Db::i()->in( 'index_container_id', \IPS\Settings::i()->ExcludeFromStreams_{$app}, TRUE ); } } $this->where[] = array_merge( array( $type ? ( '( ' . implode( ' OR ', $where ) . ' )' ) : ( '!( ' . implode( ' OR ', $where ) . ' )' ) ), $params ); } return $this; } How would I exclude the class and the container id in the same statement?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.