wp_update_comment($commentdata); } else { $comment_id = wp_new_comment($commentdata); } $comment = get_comment($comment_id); if (!$user->ID) { $comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000); setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); } $comment_depth = 1; $tmp_c = $comment; while ($tmp_c->comment_parent != 0) { $comment_depth++; $tmp_c = get_comment($tmp_c->comment_parent); } echo '<li '; comment_class(); echo ' id="comment-' . get_comment_ID() . '">'; echo '<div class="comt-avatar">' . MBT_get_the_avatar($comment->comment_author_email, '36') . '</div>'; echo '<div class="comt-main" id="div-comment-' . get_comment_ID() . '">'; echo get_comment_text(); if ($comment->comment_approved == '0') { echo '<span class="comt-approved">您的评论正在排队审核中,请稍后!</span><br />'; } echo '<div class="comt-meta">'; echo '<span class="comt-author">' . get_comment_author_link() . '</span>'; echo get_comment_time('m-d H:i'); echo '</div>'; echo '</div>';
function MBT_comment_list($comment, $args, $depth) { echo '<li '; comment_class(); echo ' id="comment-' . get_comment_ID() . '">'; echo '<div class="comt-avatar">' . MBT_get_the_avatar($comment->comment_author_email, '36') . '</div>'; echo '<div class="comt-main" id="div-comment-' . get_comment_ID() . '">'; echo str_replace(' src=', ' data-original=', convert_smilies(get_comment_text())); if ($comment->comment_approved == '0') { echo '<span class="comt-approved">您的评论正在排队审核中,请稍后!</span><br />'; } echo '<div class="comt-meta">'; echo '<span class="comt-author">' . get_comment_author_link() . '</span>'; echo get_comment_time("m-d H:i"); 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 edit_comment_link(__('(编辑)'), ' - ', ''); } echo '</div>'; echo '</div>'; }
function mode_newcomments($limit, $outpost, $outer) { global $wpdb; $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author,user_id, comment_date_gmt, comment_approved,comment_author_email, comment_type,comment_author_url, SUBSTRING(comment_content,1,40) AS com_excerpt FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE comment_post_ID!='" . $outpost . "' AND 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 .= '<li><a href="' . get_permalink($comment->ID) . '#comment-' . $comment->comment_ID . '" title="' . $comment->post_title . '上的评论">' . MBT_get_the_avatar($comment->comment_author_email, '36') . '<strong>' . strip_tags($comment->comment_author) . '</strong> <span class="muted">' . get_comment_time("m-d H:i") . '说:<br>' . str_replace(' src=', ' data-original=', convert_smilies(strip_tags($comment->com_excerpt))) . '</span></a></li>'; } echo $output; }
<h3 class="title"> <strong>评论已关闭!</strong> </h3> <?php } else { ?> <form action="<?php echo get_option('siteurl'); ?> /wp-comments-post.php" method="post" id="commentform"> <div class="comt"> <div class="comt-title"> <?php global $current_user; get_currentuserinfo(); echo MBT_get_the_avatar($current_user->user_email, '28'); if (is_user_logged_in()) { printf('<p>' . $user_identity . '</p>'); } else { if (get_option('require_name_email') && !empty($comment_author_email)) { printf('<p>' . $comment_author . '</p>'); } else { printf('发表我的观点'); } } ?> <p><a id="cancel-comment-reply-link" href="javascript:;">取消</a></p> </div> <div class="comt-box"> <textarea placeholder="你的评论..." class="input-block-level comt-area" name="comment" id="comment" cols="100%" rows="3" tabindex="1" onkeydown="if(event.ctrlKey&&event.keyCode==13){document.getElementById('submit').click();return false};"></textarea> <div class="comt-ctrl">