Add comment-author-is-site-member
class to comment output for site members.
Add a class to allow targeting of comments made by members of a site rather than users of the entire network. Props Viper007Bond, MikeHansenMe. Fixes #24054. git-svn-id: https://develop.svn.wordpress.org/trunk@31518 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ff0b2f7a6f
commit
a86c3114ae
@ -420,17 +420,23 @@ function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
|
||||
// Get the comment type (comment, trackback),
|
||||
$classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type;
|
||||
|
||||
// If the comment author has an id (registered), then print the log in name
|
||||
// Add classes for comment authors that are registered users.
|
||||
if ( $comment->user_id > 0 && $user = get_userdata( $comment->user_id ) ) {
|
||||
// For all registered users, 'byuser'
|
||||
$classes[] = 'byuser';
|
||||
$classes[] = 'comment-author-' . sanitize_html_class( $user->user_nicename, $comment->user_id );
|
||||
|
||||
// If a comment author is also a member of the site (multisite).
|
||||
if ( is_user_member_of_blog( $comment->user_id ) ) {
|
||||
$classes[] = 'comment-author-is-site-member';
|
||||
}
|
||||
|
||||
// For comment authors who are the author of the post
|
||||
if ( $post = get_post($post_id) ) {
|
||||
if ( $comment->user_id === $post->post_author )
|
||||
if ( $comment->user_id === $post->post_author ) {
|
||||
$classes[] = 'bypostauthor';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty($comment_alt) )
|
||||
$comment_alt = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user