Skip to content

Commit

Permalink
Can't see COM_KUNENA_SEARCH_ERR_SHORTKEYWORD #4913 (#5038)
Browse files Browse the repository at this point in the history
  • Loading branch information
810 committed Nov 23, 2016
1 parent 19bfb01 commit 44376c0
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/components/com_kunena/models/search.php
Expand Up @@ -293,11 +293,12 @@ protected function buildOrderBy()
*/
public function getTotal()
{
$q = $this->getState('searchwords');
$text = $this->getState('searchwords');
$q = strlen($text);

if (!$q && !$this->getState('query.searchuser'))
if ($q < 3 && !$this->getState('query.searchuser') && JFactory::getApplication()->input->getString('childforums'))
{
$this->setError(JText::_('COM_KUNENA_SEARCH_ERR_SHORTKEYWORD'));
$this->app->enqueueMessage(JText::_('COM_KUNENA_SEARCH_ERR_SHORTKEYWORD'), 'error');

return 0;
}
Expand Down Expand Up @@ -352,13 +353,15 @@ public function getResults()
return $this->messages;
}

$q = $this->getState('searchwords');
$text = $this->getState('searchwords');
$q = strlen($text);

if (!$q && !$this->getState('query.searchuser'))
if (!$this->getState('query.searchuser'))
{
$this->setError(JText::_('COM_KUNENA_SEARCH_ERR_SHORTKEYWORD'));

return array();
if ($q < 3)
{
return false;
}
}

// Get results
Expand Down Expand Up @@ -418,7 +421,7 @@ public function getResults()

if (empty($this->messages))
{
$this->app->enqueueMessage(JText::sprintf('COM_KUNENA_SEARCH_NORESULTS_FOUND', $q));
$this->app->enqueueMessage(JText::sprintf('COM_KUNENA_SEARCH_NORESULTS_FOUND', '<strong>' . $text . '</strong>'));
}

return $this->messages;
Expand Down

0 comments on commit 44376c0

Please sign in to comment.