AnsPress_Common_Pages::question_permission_msg( object $_post )
Description #
Render question permissions message.
Parameters #
- $_postobject (Required) Post object.
Source #
File: includes/common-pages.php
private static function question_permission_msg( $_post ) {
$msg = false;
// Check if user is allowed to read this question.
if ( ! ap_user_can_read_question( $_post->ID ) ) {
if ( 'moderate' === $_post->post_status ) {
$msg = __( 'This question is awaiting moderation and cannot be viewed. Please check back later.', 'anspress-question-answer' );
} else {
$msg = __( 'Sorry! you are not allowed to read this question.', 'anspress-question-answer' );
}
} elseif ( 'future' === $_post->post_status && ! ap_user_can_view_future_post( $_post ) ) {
$time_to_publish = human_time_diff( strtotime( $_post->post_date ), ap_get_current_timestamp() );
$msg = '<strong>' . sprintf(
// Translators: %s contain time to publish.
__( 'Question will be published in %s', 'anspress-question-answer' ),
$time_to_publish
) . '</strong>';
$msg .= '<p>' . esc_attr__( 'This question is not published yet and is not accessible to anyone until it get published.', 'anspress-question-answer' ) . '</p>';
}
/**
* Filter single question page permission message.
*
* @param string $msg Message.
* @since 4.1.0
*/
$msg = apply_filters( 'ap_question_page_permission_msg', $msg );
return $msg;
}
Expand full source code Collapse full source code View on GitHub: includes/common-pages.php:78
Add your comment