mirror of
https://github.com/Mibew/real-ban-plugin.git
synced 2025-01-22 09:30:32 +03:00
Simplify threads filtering
This commit is contained in:
parent
367d8c81fd
commit
f2619bb105
14
Plugin.php
14
Plugin.php
@ -74,17 +74,15 @@ class Plugin extends AbstractPlugin implements PluginInterface
|
|||||||
*/
|
*/
|
||||||
public function alterThreads(&$args)
|
public function alterThreads(&$args)
|
||||||
{
|
{
|
||||||
$modified = false;
|
$threads = array();
|
||||||
foreach ($args['threads'] as $key => $thread) {
|
foreach ($args['threads'] as $thread) {
|
||||||
if ($thread['ban']) {
|
if ($thread['ban']) {
|
||||||
unset($args['threads'][$key]);
|
// Skip banned threads
|
||||||
$modified = true;
|
continue;
|
||||||
}
|
}
|
||||||
|
$threads[] = $thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($modified) {
|
$args['threads'] = $threads;
|
||||||
// Keep keys of the array serial.
|
|
||||||
$args['threads'] = array_values($args['threads']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user