attachListener(Events::USERS_UPDATE_THREADS_ALTER, $this, 'alterThreads'); } /** * Specify dependencies of the plugin. * * @return array List of dependencies */ public static function getDependencies() { // This plugin does not depend on others so return an empty array. return array(); } /** * A handler for * {@link \Mibew\EventDispatcher\Events::USERS_UPDATE_THREADS_ALTER} event. * * @param array $args Event arguments. */ public function alterThreads(&$args) { $modified = false; foreach ($args['threads'] as $key => $thread) { if ($thread['ban']) { unset($args['threads'][$key]); $modified = true; } } if ($modified) { // Keep keys of the array serial. $args['threads'] = array_values($args['threads']); } } }