From 1fe1e8997d39baa0697bee27664a3a024df3bb84 Mon Sep 17 00:00:00 2001 From: Albert221 Date: Sun, 3 Jan 2016 14:26:41 +0100 Subject: [PATCH] #256 Added multiple author search gambit --- .../src/Core/Search/Discussion/Gambit/AuthorGambit.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/framework/core/src/Core/Search/Discussion/Gambit/AuthorGambit.php b/framework/core/src/Core/Search/Discussion/Gambit/AuthorGambit.php index 640e7b752..62e399cd3 100644 --- a/framework/core/src/Core/Search/Discussion/Gambit/AuthorGambit.php +++ b/framework/core/src/Core/Search/Discussion/Gambit/AuthorGambit.php @@ -45,10 +45,14 @@ class AuthorGambit extends AbstractRegexGambit throw new LogicException('This gambit can only be applied on a DiscussionSearch'); } - $username = trim($matches[1], '"'); + $usernames = trim($matches[1], '"'); + $usernames = explode(',', $usernames); - $id = $this->users->getIdForUsername($username); + $ids = []; + foreach($usernames as $username) { + $ids[] = $this->users->getIdForUsername($username); + } - $search->getQuery()->where('start_user_id', $negate ? '!=' : '=', $id); + $search->getQuery()->whereIn('start_user_id', $ids, 'and', $negate); } }