Skip to content

Commit

Permalink
Merge pull request #6 from trendwerk/notice-logged-out
Browse files Browse the repository at this point in the history
Fix notice when user is logged out
  • Loading branch information
haroldangenent committed Oct 16, 2018
2 parents eeb1d48 + 2a1526d commit d3a6c07
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Hook/Posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public function search($sql, WP_Query $query)
$andClauses = array_values(array_filter(explode($and, $sql)));

foreach ($andClauses as $index => &$clause) {
if (! isset($searchWords[$index])) {
continue;
}

$searchWord = $searchWords[$index];
$searches = [];

Expand Down
1 change: 1 addition & 0 deletions tests/Search/Hook/PostsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ private function search(array $searchTerms, Posts $posts = null)
}

$baseSql = mb_substr($baseSql, 0, mb_strlen($baseSql) - mb_strlen($or));
$baseSql .= $and . "SOME OTHER QUERY";
$baseSql .= ")";

return $posts->search($baseSql, $this->getQuery(true, $searchTerms));
Expand Down

0 comments on commit d3a6c07

Please sign in to comment.