Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
in Plugins by

Just got stuck by using a filter module to prevent duplicate questions: http://www.question2answer.org/qa/24985/prevent-duplicate-question-titles?show=25346#c25346

Can I use

function filter_question(&$question, &$errors, $oldquestion)

to find out if a question is updated?

I thought $oldquestion contains data if it is an update and is NULL if it is a new question, but it does not seem to be like that...

Thanks for your help.

1 Answer

+1 vote

RTFM... http://www.question2answer.org/modules.php?module=filter

If the question is being edited, $oldquestion will contain an array of the previous values, otherwise it will be null. The elements in these arrays are described in the table below - any element may be absent, so your function should check with isset() as appropriate.

To identify a new post I am using now: if( is_null($oldquestion) ) { ... } and it works.