Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
  • Register
Welcome to the Q&A for Question2Answer.

If you have questions about the platform, click here to ask and please use English.

If you just want to try Q2A, please use the demo, which also grants admin access.

Apr 29: Q2A 1.5.2

NEED Bad Word Filter !

+7 votes
can you add bad words filter in admin panel?
asked Apr 6, 2010 in Q2A Core by anonymous

2 Answers

+2 votes
It's a good idea. I'm afraid it won't make it into version 1.0, but I've put it on the roadmap.
answered Apr 6, 2010 by gidgreen
+1 vote
You could modify the code to add this in yourself, I did something similar. Here's how:

1. Add a function, e.g. "qa_content_format" to qa-util-string.php to format the string. In your case you might have something like:

    function qa_content_format($string)
    {
        $search = array( 'shit', 'fuck' );
        $replace = array( 's***', 'f***' );
        return str_replace( $search, $replace, $string );
    }

2. In qa-app-post-create.php call that function from the first line of the functions 'qa_question_create', 'qa_answer_create' and 'qa_comment_create' for the title and/or content, e.g.

    $title = qa_content_format($title);
    $content = qa_content_format($content);

3. Do the same in qa-app-post-update.php for the functions 'qa_question_set_text', 'qa_answer_set_text', 'qa_comment_set_text'.
answered Jun 15, 2010 by DisgruntledGoat
edited Jun 15, 2010 by DisgruntledGoat