Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
2.2k views
in Q2A Core by

I found out that q2a is warning you if you comment twice the same content... "seems to be duplicate"

Why is it not implemented in question-post-mechanism? How would we do that?

I posted a 1-to-1-copy without any problems or warning message here.

As a lot of users post their question twice in my forum, although I am having a static message "duplicate questions get deleted", I need such a prevent-duplicate-mechanism.

by
Hi Kai,
Did you turn this solution into a plugin?
by
I have a custom filter plugin in use but it is not yet polished for a release.
by
Oh all right!

1 Answer

+3 votes
by
selected by
 
Best answer

As a first step I intercept duplicate question titles.

Implementation:

Create a filter module and use:

// check if question title already exists, prevent duplicate
$quTitleExists = qa_db_read_one_value( qa_db_query_sub('SELECT title
                            FROM `^posts`
                            WHERE title = #
                            AND type = "Q"
                            LIMIT 1', $question['title']), true
                );

if( $quTitleExists && is_null($oldquestion) ) {
    $errors['title'] = 'This question already exists.';
}

see also http://question2answer.org/qa/24985/prevent-duplicate-question-titles

by
+1
Is this code will prevent duplicate questions ?
What it does to prevent it ?
Where we should place it in which file and which line ?
Please explain
...