コード例 #1
0
function nh_vote_it_link($post_id = null, $link_text = null, $already_voted = null, $echo = true)
{
    global $current_user;
    global $app_url;
    $app_url = get_bloginfo('url');
    //	$already_voted = __('You already voted on this', 'vote');
    global $user_ID, $post;
    if (is_null($post_id)) {
        $post_id = $post->ID;
    }
    $vote_count = nh_get_vote_count($post_id);
    ob_start();
    if (!nh_user_has_voted_post($user_ID, $post_id)) {
        echo '<a id="votethis"';
        if (!is_user_logged_in()) {
            echo 'href="#"';
        }
        echo '  title="Vote on this Idea" class="vote votethis nh-btn-blue" data-post-id="' . $post_id . '" data-user-id="' . $user_ID . '">Vote</a>';
    } else {
        // Seems to duplicate php if/else on page ??
        echo '<span class="byline"><a id="votedthis" title="See your other Votes" href="' . $app_url . '/author/' . $current_user->user_login . '" class="votedthis nhline">You voted</a></span>';
    }
    if ($echo) {
        echo apply_filters('nh_links', ob_get_clean());
    } else {
        return apply_filters('nh_links', ob_get_clean());
    }
}
コード例 #2
0
ファイル: category-ideas.php プロジェクト: moscarar/cityhow
    ?>
</li>
<?php 
} else {
    while ($fdbk_query->have_posts()) {
        $fdbk_query->the_post();
        ?>

		<li class="fdbk-list" id="post-<?php 
        echo $post->ID;
        ?>
">
			<div class="vote-btn">
<?php 
        if (is_user_logged_in()) {
            if (nh_user_has_voted_post($current_user->ID, $post->ID)) {
                echo '<span class="byline"><a id="votedthis" title="See your other Votes" href="' . $app_url . '/author/' . $current_user->user_login . '" class="votedthis nhline">You voted</a></span>';
            } else {
                nh_vote_it_link();
            }
        }
        ?>
			</div>
			<div class="vote-question"><strong><a class="nhline" href="<?php 
        the_permalink();
        ?>
" title="See <?php 
        echo the_title();
        ?>
"><?php 
        the_title();