Beispiel #1
0
                    }
                }
                ?>

	<li <?php 
                comment_class();
                ?>
 id="li-comment-<?php 
                comment_ID();
                ?>
">
		<div id="comment-<?php 
                comment_ID();
                ?>
" <?php 
                echo $classname;
                ?>
>
    
		<div class="comment-author vcard">
			<?php 
                echo get_user_avatar($comment->user_id, 45, $comment->comment_author_email);
                ?>

		</div><!-- .comment-author .vcard -->
         <div class="wpanswerstuff">
        <ul>
  
        <li>
        	<?php 
                $commentAuthID = get_user_meta($comment->user_id);
                $commentAuthName = $commentAuthID['facebookusername'][0];
                $commentAuthLink = "http://facebook.com/" . $commentAuthID['facebookuserid'][0];
                if ($commentAuthName == "") {
                    $commentAuthName = "Anonymous";
                }
                if ($commentAuthLink == "") {
                    $commentAuthLink = "#";
                }
                ?>
        	<!-- <span><?php 
                //print_r($commentAuthID)
                ?>
</span> -->
        	<a href="<?php 
                echo $commentAuthLink;
                ?>
" class="comment-name" target="_blank" ><?php 
                echo $commentAuthName;
                ?>
</a>
			<br/>
        	<a href="<?php 
                echo esc_url(get_comment_link($comment->comment_ID));
                ?>
">
			<?php 
                /* translators: 1: date, 2: time */
                printf(__('%1$s at %2$s', 'capiton'), get_comment_date(), get_comment_time());
                ?>
</a><?php 
                edit_comment_link(__('(Edit)', 'capiton'), ' ');
                ?>
</li>
        <?php 
                if ($hide_voting == 0) {
                    ?>
<li id="report_<?php 
                    echo $comment->comment_ID;
                    ?>
"><a href="#" class="reportme" commentid="<?php 
                    echo $comment->comment_ID;
                    ?>
">Report This Post</a></li><?php 
                }
                ?>

        <?php 
                if (current_user_can('moderate_comments') || is_user_logged_in() && $post->user_id == $user->ID) {
                    ?>

        <!-- <li><a href="#" class="bestanswer" commentid="<?php 
                    echo $comment->comment_ID;
                    ?>
">Select as Best Answer</a></li> -->
        <?php 
Beispiel #2
0
        jQuery("a.vote").click(function(e) {
            e.preventDefault;
            var commentID = jQuery(this).attr("commentid");
            var action = jQuery(this).attr("action");
            if(action != "upvote" && action != "downvote") return;
            
            jQuery.get("' . get_bloginfo('url') . '/?"+action+"="+commentID, function(data) {
                jQuery("#comment-"+commentID+" .total-votes").text(data.votes);
                jQuery("#comment-"+commentID+" .voting-buttons").remove();
            });
            return false;
        });
    });
    </script>
    ';
}
add_action('init', 'comment_vote_init');
add_action('wp_footer', 'comment_vote_js');
/**
 * Handle ajax call 
 */
if (!empty($_GET['upvote'])) {
    $comment_id = (int) $_GET['upvote'];
    comment_upvote($comment_id);
    get_comment_votes($comment_id, true);
}
if (!empty($_GET['downvote'])) {
    $comment_id = (int) $_GET['downvote'];
    comment_downvote($comment_id);
    get_comment_votes($comment_id, true);
}