Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
488 views
in Q2A Core by
I would like to block a couple of "common" tags that add no meaning to the question, i.e. just remove them when the user submits the question. Where would I need to look in the code to do this?

1 Answer

0 votes
by
selected by
 
Best answer
The place would be qa_question_create() in qa-app-post-create.php. You can insert some code at the beginning to filter the tag input:

Use qa_tagstring_to_tags() to convert $tagstring to an array of tags. You can then use PHP's array_search() function to check for a particular tag, and then remove it using unset(). Finally use qa_tags_to_tagstring() to convert the tags array back into a string which you reassign to $tagstring.

BTW, if those tags really concern you, you should consider doing the same in qa_question_set_text() in qa-app-post-update.php, so that someone can't insert those tags afterwards by editing their question.
by
I added some code in the "qa_tags_to_tagstring" function to remove a specific tag, will that do it? It seems to be working at the moment.

Also, what's the easiest way to remove questions with that tag already? I tried deleting the tags from the "qa_posts" table but they still show up.
by
Never mind, realized I needed to delete from "qa_posttags" too.
...