AnsPress_Admin::options_uac_posting()

Description #

Register AnsPress user access control options.

Changelog #

VersionDescription
4.1.0Introduced.

Source #

File: admin/anspress-admin.php

1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
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