This function helps for such a plugin:
function qa_post_set_closed($questionid, $closed=true, $originalpostid=null, $note=null, $byuserid=null)
/*
Closed $questionid if $closed is true, otherwise reopen it. If $closed is true, pass either the $originalpostid of the question that it is a duplicate of, or a $note to explain why it's closed. Pass the identify of the user in $byuserid (or null for an anonymous change).*/
I was creating an event module that automatically closes the question, this is part of the necessary code:
function process_event($event, $userid, $handle, $cookieid, $params) {
// Specials for Klaustukai
// if question
$hitEvents = array('q_post', 'q_edit');
if(in_array($event, $hitEvents)) {
// 1. close interviu question if posted from user klaustukai with tag interviu
if($userid == 1 && strpos($params['tags'],'interviu')!==false) {
$note = 'interviu';
require_once QA_INCLUDE_DIR.'qa-app-posts.php';
// qa_post_set_closed($questionid, $closed=true, $originalpostid=null, $note=null, $byuserid=null)
// error_log($params['postid'].','.$note.','.$userid);
qa_post_set_closed($params['postid'], true, null, $note, $userid);
}
}
} // end process_event