WordPress.org

Make WordPress Core

Changeset 31518


Ignore:
Timestamp:
02/23/2015 02:51:49 AM (5 years ago)
Author:
jeremyfelt
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r31459 r31518  
    421421    $classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type;
    422422
    423     // If the comment author has an id (registered), then print the log in name
    424     if ( $comment->user_id > 0 && $user = get_userdata($comment->user_id) ) {
    425         // For all registered users, 'byuser'
     423    // Add classes for comment authors that are registered users.
     424    if ( $comment->user_id > 0 && $user = get_userdata( $comment->user_id ) ) {
    426425        $classes[] = 'byuser';
    427         $classes[] = 'comment-author-' . sanitize_html_class($user->user_nicename, $comment->user_id);
     426        $classes[] = 'comment-author-' . sanitize_html_class( $user->user_nicename, $comment->user_id );
     427
     428        // If a comment author is also a member of the site (multisite).
     429        if ( is_user_member_of_blog( $comment->user_id ) ) {
     430            $classes[] = 'comment-author-is-site-member';
     431        }
     432
    428433        // For comment authors who are the author of the post
    429434        if ( $post = get_post($post_id) ) {
    430             if ( $comment->user_id === $post->post_author )
     435            if ( $comment->user_id === $post->post_author ) {
    431436                $classes[] = 'bypostauthor';
     437            }
    432438        }
    433439    }
Note: See TracChangeset for help on using the changeset viewer.