ap_new_edit_post_status( boolean|integer $user_id = false, string $post_type = 'question', boolean $edit = false )
Description #
Return post status based on AnsPress options.
Parameters #
- $user_idboolean | integer (Optional) ID of user creating question. Default value: false
- $post_typestring (Optional) Post type, question or answer. Default value: 'question'
- $editboolean (Optional) Is editing post. Default value: false
Source #
File: includes/functions.php
function ap_new_edit_post_status( $user_id = false, $post_type = 'question', $edit = false ) { if ( false === $user_id ) { $user_id = get_current_user_id(); } $new_edit = $edit ? 'edit' : 'new'; $option_key = $new_edit . '_' . $post_type . '_status'; $status = 'publish'; // If super admin or user have no_moderation cap. if ( is_super_admin( $user_id ) || user_can( $user_id, 'ap_no_moderation' ) ) { return $status; } if ( ap_opt( $option_key ) === 'moderate' && ! ( user_can( $user_id, 'ap_moderator' ) || is_super_admin( $user_id ) ) ) { $status = 'moderate'; } // If anonymous post status is set to moderate. if ( empty( $user_id ) && ap_opt( 'anonymous_post_status' ) === 'moderate' ) { $status = 'moderate'; } return $status; }
Expand full source code Collapse full source code View on GitHub: includes/functions.php:1212
Add your comment