Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
in Q2A Core by

If we want to close a question there is an option:"this is similar to another question". And then I use Kai's override to mark that question as [duplicated].

I want there exists another option: "Closed as off-topic"and then mark it as [off-topic].


Q2A version: 1.6.3

1 Answer

+2 votes
selected by
Best answer

It is a dirty fix but should work:

function q_item_title($q_item) {
    $html = '';
    if(isset($q_item['raw']['closedbyid'])) {
        $result = qa_db_read_one_assoc(qa_db_query_sub(
            'SELECT content, type FROM ^posts WHERE postid = #',
            ), true
        if(isset($result)) {
            if ($result['type'] === 'NOTE') {
                $reason = 'Off-topic';
                $class = 'offtopic';
            } else {
                $reason = 'Duplicate';
                $class = 'duplicate';
            $html = sprintf('<span class="qa-q-%s">[%s]</span>', $class, $reason);
        '<div class="qa-q-item-title">',
        sprintf('<a href="%s">%s</a>', $q_item['url'], $q_item['title']),
This will output Off-topic or Duplicate as the text and qa-q-duplicate and qa-q-offtopic as the CSS classes to use in each case.
Pupi1985: Thanks. But there is an error for me:Fatal error: Cannot redeclare qa_html_theme::q_item_title()...
That's because you are adding the code and you should replace the function that you've added previously.
you're Right! It works for me. Thank you very much.