Disable anspress users to answer a closed conversation in my website

After the discussion is closed, how can I disable my website users to answer that closed discussion that is labeled as “closed” at my anspress plugin Q&A forum?

Is there anyway that you will help me out to change the code of anspress plugin such as follows?
http://snowykyoko.com/caselaw/legal-answers-2/question/186/howdy-titus-here/

Related posts

Leave a Reply

1 comment

  1. You can simply check if question has closed term using:

    has_term( 'closed', 'question_label', get_question_id() )
    

    Code for version 1.4.3:

    Create a theme override by simply creating a new folder called anspress inside your active theme (not child theme).
    Now copy anspress/theme/default/answer-form.php to your newly created folder.

    Now paste this:

    <?php
        $question_id =get_question_id() ;
        $current_user = get_userdata( get_current_user_id() );
        $validate = ap_validate_form();
        if(!empty($validate['has_error'])){
        echo '<div class="alert alert-danger" data-dismiss="alert"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>'. __('Problem submitting form, please recheck form', 'ap') .'</div>';
        }
    ?>
    <?php 
    // make sure closed label slug is "closed"
    if( ap_question_have_labels() && has_term( 'closed', 'question_label', get_question_id() ) ): ?>
        <div id="answer-form-c">        
            <div class="ap-avatar">
                <?php echo get_avatar( $current_user->user_email, ap_opt('avatar_size_qquestion') ); ?>
            </div>
            <?php ap_answer_form($question_id); ?>
        </div>
    <?php endif; ?>