AnsPress_Admin::options_postscomments()

Description #

Register AnsPress QA options.

Changelog #

VersionDescription
4.1.0Introduced.

Source #

File: admin/anspress-admin.php

	public static function options_postscomments() {
		$opt = ap_opt();

		$form = array(
			'fields' => array(
				'comment_number'                => array(
					'label'   => __( 'Numbers of comments to show', 'anspress-question-answer' ),
					'desc'    => __( 'Numbers of comments to load in each query?', 'anspress-question-answer' ),
					'value'   => $opt['comment_number'],
					'subtype' => 'number',
				),
				'duplicate_check'               => array(
					'label' => __( 'Check duplicate', 'anspress-question-answer' ),
					'desc'  => __( 'Check for duplicate posts before posting', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['duplicate_check'],
				),
				'disable_q_suggestion'          => array(
					'label' => __( 'Disable question suggestion', 'anspress-question-answer' ),
					'desc'  => __( 'Checking this will disable question suggestion in ask form', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['disable_q_suggestion'],
				),
				'default_date_format'           => array(
					'label' => __( 'Show default date format', 'anspress-question-answer' ),
					'desc'  => __( 'Instead of showing time passed i.e. 1 Hour ago, show default format date.', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['default_date_format'],
				),
				'show_solved_prefix'            => array(
					'label'    => __( 'Show solved prefix', 'anspress-question-answer' ),
					'desc'     => __( 'If an answer is selected for question then [solved] prefix will be added in title.', 'anspress-question-answer' ),
					'type'     => 'checkbox',
					'value'    => $opt['show_solved_prefix'],
					'validate' => 'required',
				),
				'question_order_by'             => array(
					'label'   => __( 'Default question order', 'anspress-question-answer' ),
					'desc'    => __( 'Order question list by default using selected', 'anspress-question-answer' ),
					'type'    => 'select',
					'options' => array(
						'voted'  => __( 'Voted', 'anspress-question-answer' ),
						'active' => __( 'Active', 'anspress-question-answer' ),
						'newest' => __( 'Newest', 'anspress-question-answer' ),
						'oldest' => __( 'Oldest', 'anspress-question-answer' ),
					),
					'value'   => $opt['question_order_by'],
				),
				'keep_stop_words'               => array(
					'label' => __( 'Keep stop words in question slug', 'anspress-question-answer' ),
					'desc'  => __( 'AnsPress will not strip stop words in question slug.', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['keep_stop_words'],
				),
				'minimum_qtitle_length'         => array(
					'label'   => __( 'Minimum title length', 'anspress-question-answer' ),
					'desc'    => __( 'Set minimum letters for a question title.', 'anspress-question-answer' ),
					'subtype' => 'number',
					'value'   => $opt['minimum_qtitle_length'],
				),
				'minimum_question_length'       => array(
					'label'   => __( 'Minimum question content', 'anspress-question-answer' ),
					'desc'    => __( 'Set minimum letters for a question contents.', 'anspress-question-answer' ),
					'subtype' => 'number',
					'value'   => $opt['minimum_question_length'],
				),
				'question_text_editor'          => array(
					'label' => __( 'Question editor?', 'anspress-question-answer' ),
					'desc'  => __( 'Quick tags editor', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['question_text_editor'],
				),
				'answer_text_editor'            => array(
					'label' => __( 'Answer editor?', 'anspress-question-answer' ),
					'desc'  => __( 'Quick tags editor', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['answer_text_editor'],
				),
				'disable_comments_on_question'  => array(
					'label' => __( 'Disable comments', 'anspress-question-answer' ),
					'desc'  => __( 'Disable comments on questions.', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['disable_comments_on_question'],
				),
				'disable_voting_on_question'    => array(
					'label' => __( 'Disable voting', 'anspress-question-answer' ),
					'desc'  => __( 'Disable voting on questions.', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['disable_voting_on_question'],
				),
				'disable_down_vote_on_question' => array(
					'label' => __( 'Disable down voting', 'anspress-question-answer' ),
					'desc'  => __( 'Disable down voting on questions.', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['disable_down_vote_on_question'],
				),
				'close_selected'                => array(
					'label' => __( 'Close question after selecting answer', 'anspress-question-answer' ),
					'desc'  => __( 'If enabled this will prevent user to submit answer on solved question.', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['close_selected'],
				),
				'answers_sort'                  => array(
					'label'   => __( 'Default answers order', 'anspress-question-answer' ),
					'desc'    => __( 'Order answers by by default using selected', 'anspress-question-answer' ),
					'type'    => 'select',
					'options' => array(
						'voted'  => __( 'Voted', 'anspress-question-answer' ),
						'active' => __( 'Active', 'anspress-question-answer' ),
						'newest' => __( 'Newest', 'anspress-question-answer' ),
						'oldest' => __( 'Oldest', 'anspress-question-answer' ),
					),
					'value'   => $opt['answers_sort'],
				),
				'minimum_ans_length'            => array(
					'label'   => __( 'Minimum answer content', 'anspress-question-answer' ),
					'desc'    => __( 'Set minimum letters for a answer contents.', 'anspress-question-answer' ),
					'subtype' => 'number',
					'value'   => $opt['minimum_ans_length'],
				),
				'disable_comments_on_answer'    => array(
					'label' => __( 'Disable comments', 'anspress-question-answer' ),
					'desc'  => __( 'Disable comments on answer.', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['disable_comments_on_answer'],
				),
				'disable_voting_on_answer'      => array(
					'label' => __( 'Disable voting', 'anspress-question-answer' ),
					'desc'  => __( 'Disable voting on answers.', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['disable_voting_on_answer'],
				),
				'disable_down_vote_on_answer'   => array(
					'label' => __( 'Disable down voting', 'anspress-question-answer' ),
					'desc'  => __( 'Disable down voting on answers.', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['disable_down_vote_on_answer'],
				),
			),
		);

		/**
		 * Filter to override post and comments options form.
		 *
		 * @param array $form Form arguments.
		 * @since 4.1.0
		 */
		return apply_filters( 'ap_options_form_postscomments', $form );
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment