post_status == 'private_post' ? true : false; } $args = array( 'name' => 'answer_form', 'is_ajaxified' => true, 'submit_button' => ($editing ? __( 'Update answer', 'anspress-question-answer' ) : __( 'Post answer', 'anspress-question-answer' )), 'nonce_name' => 'nonce_answer_'.$question_id, 'fields' => array( array( 'name' => 'description', 'type' => 'editor', 'value' => ( $editing ? apply_filters( 'the_content', $editing_post->post_content ) : wp_kses_post( @$_POST['description'] ) ), 'settings' => apply_filters( 'ap_answer_form_editor_settings', array( 'textarea_rows' => 8, 'tinymce' => ap_opt( 'answer_text_editor' ) ? false : true, 'quicktags' => ap_opt( 'answer_text_editor' ) ? true : false, 'media_buttons' => false, )), 'placeholder' => __( 'Your answer..', 'anspress-question-answer' ), ), array( 'name' => 'form_question_id', 'type' => 'hidden', 'value' => ( $editing ? $editing_post->post_parent : $question_id ), 'order' => 20, ), ), ); if ( ! is_user_logged_in() && ap_opt( 'allow_anonymous' ) ) { $args['fields'][] = array( 'name' => 'name', 'label' => __( 'Name', 'anspress-question-answer' ), 'type' => 'text', 'placeholder' => __( 'Enter your name to display', 'anspress-question-answer' ), 'value' => sanitize_text_field( @$_POST['name'] ), 'order' => 12, ); } // If private posts is allowed then show the checkbox. if ( ap_opt( 'allow_private_posts' ) ) { $args['fields'][] = array( 'name' => 'is_private', 'type' => 'checkbox', 'desc' => __( 'Only visible to admin and moderator.', 'anspress-question-answer' ), 'value' => $is_private, 'order' => 12, 'show_desc_tip' => false, ); } if ( ap_show_captcha_to_user() ) { // Show recpatcha if key exists and enabled. if ( ap_opt( 'recaptcha_site_key' ) == '' ) { $reCaptcha_html = '