From 646e643e5dad7d4dccf4e145d62fec419990e471 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Mon, 23 Feb 2015 02:52:24 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@31518 git-svn-id: http://core.svn.wordpress.org/trunk@31499 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 16 +++++++++++----- wp-includes/version.php | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index d05f684248..ca12ad7940 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -420,15 +420,21 @@ 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 - if ( $comment->user_id > 0 && $user = get_userdata($comment->user_id) ) { - // For all registered users, 'byuser' + // Add classes for comment authors that are registered users. + if ( $comment->user_id > 0 && $user = get_userdata( $comment->user_id ) ) { $classes[] = 'byuser'; - $classes[] = 'comment-author-' . sanitize_html_class($user->user_nicename, $comment->user_id); + $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'; + } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index fc725c0d8c..3e26459685 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31517'; +$wp_version = '4.2-alpha-31518'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.