AnsPress_Admin::options_uac_posting()

Description #

Register AnsPress user access control options.

Changelog #

VersionDescription
4.1.0Introduced.

Source #

File: admin/anspress-admin.php

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

		$form = array(
			'fields' => array(
				'post_question_per'     => array(
					'label'   => __( 'Who can post question?', 'anspress-question-answer' ),
					'desc'    => __( 'Set who can submit a question from frontend.', 'anspress-question-answer' ),
					'type'    => 'select',
					'value'   => $opt['post_question_per'],
					'options' => array(
						'anyone'    => __( 'Anyone, including non-loggedin', 'anspress-question-answer' ),
						'logged_in' => __( 'Only logged in', 'anspress-question-answer' ),
						'have_cap'  => __( 'Only user having ap_new_question capability', 'anspress-question-answer' ),
					),
				),
				'post_answer_per'       => array(
					'label'   => __( 'Who can post answer?', 'anspress-question-answer' ),
					'desc'    => __( 'Set who can submit an answer from frontend.', 'anspress-question-answer' ),
					'type'    => 'select',
					'value'   => $opt['post_answer_per'],
					'options' => array(
						'anyone'    => __( 'Anyone, including non-loggedin', 'anspress-question-answer' ),
						'logged_in' => __( 'Only logged in', 'anspress-question-answer' ),
						'have_cap'  => __( 'Only user having ap_new_answer capability', 'anspress-question-answer' ),
					),
				),
				'create_account'        => array(
					'label' => __( 'Create account for non-registered', 'anspress-question-answer' ),
					'desc'  => __( 'Allow non-registered users to create account by entering their email in question. After submitting post a confirmation email will be sent to the user.', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['create_account'],
				),
				'multiple_answers'      => array(
					'label' => __( 'Multiple answers', 'anspress-question-answer' ),
					'desc'  => __( 'Allow users to submit multiple answer per question.', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['multiple_answers'],
				),
				'disallow_op_to_answer' => array(
					'label' => __( 'OP can answer?', 'anspress-question-answer' ),
					'desc'  => __( 'OP: Original poster/asker. Enabling this option will prevent users to post an answer on their question.', 'anspress-question-answer' ),
					'type'  => 'checkbox',
					'value' => $opt['disallow_op_to_answer'],
				),
				'post_comment_per'      => array(
					'label'   => __( 'Who can post comment?', 'anspress-question-answer' ),
					'desc'    => __( 'Set who can submit a comment from frontend.', 'anspress-question-answer' ),
					'type'    => 'select',
					'value'   => $opt['post_comment_per'],
					'options' => array(
						'anyone'    => __( 'Anyone, including non-loggedin', 'anspress-question-answer' ),
						'logged_in' => __( 'Only logged in', 'anspress-question-answer' ),
						'have_cap'  => __( 'Only user having ap_new_comment capability', 'anspress-question-answer' ),
					),
				),
				'new_question_status'   => array(
					'label'   => __( 'Status of new question', 'anspress-question-answer' ),
					'desc'    => __( 'Default status of new question.', 'anspress-question-answer' ),
					'type'    => 'select',
					'options' => array(
						'publish'  => __( 'Publish', 'anspress-question-answer' ),
						'moderate' => __( 'Moderate', 'anspress-question-answer' ),
					),
					'value'   => $opt['new_question_status'],
				),
				'edit_question_status'  => array(
					'label'   => __( 'Status of edited question', 'anspress-question-answer' ),
					'desc'    => __( 'Default status of edited question.', 'anspress-question-answer' ),
					'type'    => 'select',
					'options' => array(
						'publish'  => __( 'Publish', 'anspress-question-answer' ),
						'moderate' => __( 'Moderate', 'anspress-question-answer' ),
					),
					'value'   => $opt['edit_question_status'],
				),
				'new_answer_status'     => array(
					'label'   => __( 'Status of new answer', 'anspress-question-answer' ),
					'desc'    => __( 'Default status of new answer.', 'anspress-question-answer' ),
					'type'    => 'select',
					'options' => array(
						'publish'  => __( 'Publish', 'anspress-question-answer' ),
						'moderate' => __( 'Moderate', 'anspress-question-answer' ),
					),
					'value'   => $opt['new_answer_status'],
				),
				'edit_answer_status'    => array(
					'label'   => __( 'Status of edited answer', 'anspress-question-answer' ),
					'desc'    => __( 'Default status of edited answer.', 'anspress-question-answer' ),
					'type'    => 'select',
					'options' => array(
						'publish'  => __( 'Publish', 'anspress-question-answer' ),
						'moderate' => __( 'Moderate', 'anspress-question-answer' ),
					),
					'value'   => $opt['edit_answer_status'],
				),
				'anonymous_post_status' => array(
					'label'   => __( 'Status of non-loggedin post', 'anspress-question-answer' ),
					'desc'    => __( 'Default status of question or answer submitted by non-loggedin user.', 'anspress-question-answer' ),
					'type'    => 'select',
					'options' => array(
						'publish'  => __( 'Publish', 'anspress-question-answer' ),
						'moderate' => __( 'Moderate', 'anspress-question-answer' ),
					),
					'value'   => $opt['anonymous_post_status'],
				),
			),
		);

		/**
		 * Filter to override UAC options form.
		 *
		 * @param array $form Form arguments.
		 * @since 4.1.0
		 */
		return apply_filters( 'ap_options_form_uac', $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