Example #1
0
function ap_user_can_view_question($question_id = false)
{
    if (is_super_admin()) {
        return true;
    }
    if (!$question_id) {
        $question_id = get_the_ID();
    }
    $post = get_post($question_id);
    if ($post->post_status == 'publish' || $post->post_status == 'private_question' && ap_user_can_view_private_question($question_id)) {
        return true;
    }
    return false;
}
Example #2
0
<?php

global $post;
$clearfix_class = array('question-summary clearfix');
if (!is_private_question() || is_private_question() && ap_user_can_view_private_question(get_the_ID())) {
    ?>
<article id="question-<?php 
    the_ID();
    ?>
" <?php 
    post_class($clearfix_class);
    ?>
>
	<?php 
    if (is_private_question()) {
        ?>
		<div class="private-question-label">
			<span><?php 
        _e('Private Question', 'ap');
        ?>
</span>
		</div>
	<?php 
    }
    ?>
	<div class="wrap-right">				
		<a class="ap-vote-count ap-tip" href="#" title="<?php 
    _e('Total votes', 'ap');
    ?>
">
			<span><?php