Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
939 views
in Q2A Core by
I have been able to fix the bug affecting the emails containing banned words. I am unable to fix the bug with it showing in the search results. Questions with a banned word in the title still display the banned word in the search results.

Has anyone had any luck with fixing this? Is anyone experiencing the same problem?
Q2A version: 1.6.2

4 Answers

+1 vote
by
 
Best answer

I fixed this myself by making the following changes to the qa-app-search.php file in /qa-include/

After:

if (!isset($result['title'])) {
  if (isset($result['question']))
 
Change the next line to this:
 
$blockwordspreg = qa_get_block_words_preg();
$result['title']=qa_block_words_replace($result['question']['title'], $blockwordspreg);
 
End result is this:
 
if (!isset($result['title'])) {
  if (isset($result['question']))
    $blockwordspreg = qa_get_block_words_preg();
    $result['title']=qa_block_words_replace($result['question']['title'], $blockwordspreg);
  elseif (isset($result['page']))
    $result['title']=$result['page']['heading'];
  }
 
+1 vote
by

Hi warcraf, 

quotes are missing in your provided code

My Modified CODE:

 

if (!isset($result['title'])) {
if (isset($result['question'])){
$blockwordspreg = qa_get_block_words_preg();
$result['title']=qa_block_words_replace($result['question']['title'], $blockwordspreg);
}
elseif (isset($result['page']))
$result['title']=$result['page']['heading'];
}

 

Source: FindoutAnswer

+2 votes
by

The best solution to this is to insert the folowing code in qa-page-search.php:

if (isset($qdefaults['blockwordspreg']))
  $result['title']=qa_block_words_replace($result['title'], $qdefaults['blockwordspreg']);
 
It should be inserted before:
 
$fields['title']=qa_html($result['title']);
 
This fix will be rolled into Q2A 1.6.3.
+1 vote
by
Found the solution to this, I had to change a few lines in /qa-include/qa-app-emails.php:
 
$blockwordspreg = qa_get_block_words_preg();
$mailer->Subject= qa_block_words_replace($params['subject'], $blockwordspreg);
$mailer->Body=qa_block_words_replace($params['body'], $blockwordspreg);
 

 search results show the banned words as well and TO REMOVE below is the code

in qa-include/qa-app-search.php

find this:

if (!isset($result['title'])) {
if (isset($result['question']))
 
 
elseif (isset($result['page']))
$result['title']=$result['page']['heading'];
}
 
Change it to this:
 
if (!isset($result['title'])) {
if (isset($result['question']))
{
$blockwordspreg = qa_get_block_words_preg();
$result['title']=qa_block_words_replace($result['question']['www.cusabio.com cusabio elisa kit], $blockwordspreg);
}
elseif (isset($result['page']))
$result['title']=$result['page']['heading'];

 

...