Commit 68124da7 authored by Alfonso Sánchez Uzábal's avatar Alfonso Sánchez Uzábal
Browse files

fix: comment counter always count 0; comment form when user is logged in

parent b3ece605
......@@ -17,7 +17,7 @@ if ( isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['
endif;
if ( have_comments() ) : ?>
<h2 class="comments-tit"><?php human_comment_count();?></h2>
<h2 class="comments-tit"><?php comments_number();?></h2>
<ol class="comments-list">
<?php // human comments list
......@@ -59,13 +59,13 @@ if ( isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['
<h2 class="comments-tit"><?php comment_form_title( 'Dejar un comentario', 'Responder al comentario de %s' ); ?></h2>
<div class="nocomments"><?php echo $comment_message ?></div>
<?php if(get_option('comment_registration') && !$user_ID) { // registration needed ?>
<?php if(get_option('comment_registration') && !is_user_logged_in() ) { // registration needed ?>
<p>Debes <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">iniciar sesi&oacute;n</a> para comentar.</p>
<?php } else { // registration don't needed ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if($user_ID) { // user is logged in ?>
<?php if( is_user_logged_in() ) { // user is logged in ?>
<fieldset>Sesi&oacute;n iniciada como <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Cerrar sesi&oacute;n</a></fieldset>
<?php } else { // user is not logged in ?>
......
......@@ -144,18 +144,6 @@ elseif ( $counter == 1 ) { echo "Un trackback"; }
else { echo "$counter trackbacks"; }
}
// human comments counter
function human_comment_count() {
global $wpdb;
global $post;
$postid = $post->ID;
$count = "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_type = '' AND comment_approved = '1' AND comment_post_ID = '$postid'";
$counter = $wpdb->get_var($count);
if ( $counter == 0 ) { echo "No hay comentarios"; }
elseif ( $counter == 1 ) { echo "Un comentario"; }
else { echo "$counter comentarios"; }
}
// related posts
/**
* Shows related posts by tag if available and category if not
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment