function readers_wall($outer = '1', $timer = '100', $limit = '200') { global $wpdb; $items = $wpdb->get_results("select count(comment_author) as cnt, comment_author, comment_author_url, comment_author_email from (select * from {$wpdb->comments} left outer join {$wpdb->posts} on ({$wpdb->posts}.id={$wpdb->comments}.comment_post_id) where comment_date > date_sub( now(), interval {$timer} month ) and user_id='0' and comment_author != '" . $outer . "' and post_password='' and comment_approved='1' and comment_type='') as tempcmt group by comment_author order by cnt desc limit {$limit}"); foreach ($items as $item) { $c_url = $item->comment_author_url; if (!$c_url) { $c_url = 'javascript:;'; } $type .= '<a target="_blank" href="' . $c_url . '" title="' . $item->comment_author . ' 评论' . $item->cnt . '次">' . hui_get_avatar($user_id = $item->user_id, $user_email = $item->comment_author_email) . '</a>'; } echo $type; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_name', $instance['title']); $limit = $instance['limit']; $outer = $instance['outer']; if (!$outer) { $outer = -1; } echo $before_widget; echo $before_title . $title . $after_title; echo '<ul>'; global $wpdb; $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved,comment_author_email, comment_type,comment_author_url, SUBSTRING(comment_content,1,60) AS com_excerpt FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE user_id!='" . $outer . "' AND comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT {$limit}"; $comments = $wpdb->get_results($sql); foreach ($comments as $comment) { $output .= $comment->user_id . '<li><a' . hui_target_blank() . ' href="' . get_permalink($comment->ID) . '#comment-' . $comment->comment_ID . '" title="' . $comment->post_title . __('上的评论', 'haoui') . '">' . hui_get_avatar($user_id = $comment->user_id, $user_email = $comment->comment_author_email) . strip_tags($comment->comment_author) . ' <span class="text-muted">' . timeago($comment->comment_date_gmt) . __('说:', 'haoui') . '<br>' . str_replace(' src=', ' data-original=', convert_smilies(strip_tags($comment->com_excerpt))) . '</span></a></li>'; } echo $output; echo '</ul>'; echo $after_widget; }
} ?> </div> <div class="slinks"> <?php echo _hui('menu_links'); ?> </div> <?php if (is_user_logged_in()) { global $current_user; get_currentuserinfo(); ?> <div class="user-welcome"> <?php echo hui_get_avatar($user_id = $current_user->ID, $user_email = $current_user->user_email, $src = true); ?> <strong><?php echo $current_user->display_name; ?> </strong><span class="text-muted"><?php echo __('欢迎登录!', 'haoui'); ?> </span> </div> <p class="user-logout"><a href="<?php echo wp_logout_url(); ?> "><?php echo __('退出', 'haoui'); ?>
function hui_comment_list($comment, $args, $depth) { echo '<li '; comment_class(); echo ' id="comment-' . get_comment_ID() . '">'; echo '<div class="c-avatar">' . hui_get_avatar($comment->user_id, $comment->comment_author_email) . '</div>'; echo '<div class="c-main" id="div-comment-' . get_comment_ID() . '">'; echo '<span class="c-author">' . get_comment_author_link() . '</span>'; echo str_replace(' src=', ' data-original=', convert_smilies(get_comment_text())); if ($comment->comment_approved == '0') { echo '<span class="c-approved">' . __('待审核', 'haoui') . '</span>'; } echo '<time class="c-time">' . timeago($comment->comment_date) . '</time>'; if ($comment->comment_approved !== '0') { echo comment_reply_link(array_merge($args, array('add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth']))); } echo '</div>'; }
?> /wp-comments-post.php" method="post" id="commentform"> <div class="comt-title"> <div class="comt-avatar"> <?php global $current_user; get_currentuserinfo(); if (is_user_logged_in()) { echo hui_get_avatar($user_id = get_current_user_id(), $user_email = $current_user->user_email); } elseif (!is_user_logged_in() && get_option('require_name_email') && $comment_author_email == '') { echo hui_get_avatar($user_id = '', $user_email = $current_user->user_email); } elseif (!is_user_logged_in() && get_option('require_name_email') && $comment_author_email !== '') { echo hui_get_avatar($user_id = '', $user_email = $comment->comment_author_email); } else { echo hui_get_avatar($user_id = '', $user_email = $comment->comment_author_email); } ?> </div> <div class="comt-author"> <?php if (is_user_logged_in()) { printf($user_identity); } else { if (get_option('require_name_email') && !empty($comment_author_email)) { printf($comment_author . ' <span>' . __('发表我的评论', 'haoui') . '</span> <a class="switch-author" href="javascript:;" data-type="switch-author" style="font-size:12px;">' . __('换个身份', 'haoui') . '</a>'); } else { printf(''); } } ?>
setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); } $comment_depth = 1; //为评论的 class 属性准备的 $tmp_c = $comment; while ($tmp_c->comment_parent != 0) { $comment_depth++; $tmp_c = get_comment($tmp_c->comment_parent); } //以下是評論式樣, 不含 "回覆". 要用你模板的式樣 copy 覆蓋. echo '<li '; comment_class(); echo ' id="comment-' . get_comment_ID() . '">'; //头像 echo '<div class="c-avatar">'; /*global $loguser; if( $loguser ){ echo '<img src="'.$loguser->avatar.'">'; }else{*/ echo hui_get_avatar($user_id = $comment->user_id, $user_email = $comment->comment_author_email, $src = true); // } echo '</div>'; //内容 echo '<div class="c-main" id="div-comment-' . get_comment_ID() . '">'; echo '<span class="c-author">' . get_comment_author_link() . '</span>'; echo str_replace(' src=', ' data-original=', convert_smilies(get_comment_text())); if ($comment->comment_approved == '0') { echo '<span class="c-approved">' . __('待审核', 'haoui') . '</span>'; } echo '<time class="c-time">' . timeago($comment->comment_date) . '</time>'; echo '</div>';