Opened 14 years ago
Closed 11 years ago
#16944 closed enhancement (wontfix)
Add new 'bynetworkuser' CSS class to output from comment-template.php
Reported by: | jacques_chester | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | has-patch |
Focuses: | Cc: |
Description
Currently, the comment-template.php file checks to see whether a comment author is in the wp_user table.
If they are, then WordPress will emit a 'byuser' class as part of the comment div markup.
However, this behaviour is not ideal from multisite installations. 'byuser' should be restricted on a per-blog basis.
I propose that the current behaviour be assigned to a new CSS class, 'bynetworkuser'.
Attachments (2)
Change History (12)
#1
@
14 years ago
Your diff doesn't contain the file name (it's just ".php").
Please make patches against the root wp directory.
#2
follow-up:
↓ 3
@
14 years ago
Is changing the context in which the byuser
class is applied going to cause back-compat issues?
#3
in reply to:
↑ 2
@
14 years ago
Replying to solarissmoke:
Is changing the context in which the
byuser
class is applied going to cause back-compat issues?
Yes.
If anything we should add by-user-of-blog.
#4
@
14 years ago
- Keywords has-patch added
If we want to add this, here's a patch, otherwise wontfix.
#5
@
11 years ago
- Resolution set to wontfix
- Status changed from new to closed
Don't see a real need to fix this.
#6
@
11 years ago
- Resolution wontfix deleted
- Status changed from closed to reopened
I reopening this. I can see the use case. You maybe want to style on the class but only for users are member for that site.
#7
@
11 years ago
- Milestone changed from Awaiting Review to 3.7
Agreed. Does by-blog-user
still make sense for the CSS class or could it be by-site-user
?
FYI - patch still applies cleanly.
#8
follow-up:
↓ 9
@
11 years ago
Need to keep an eye on the performance impact of adding this in. The patch adds a call to is_user_member_of_blog()
to every comment, which calls get_blog_details()
for every blog that the user is a member of.
#9
in reply to:
↑ 8
@
11 years ago
Replying to johnbillion:
Need to keep an eye on the performance impact of adding this in. The patch adds a call to
is_user_member_of_blog()
to every comment, which callsget_blog_details()
for every blog that the user is a member of.
This is really expensive. The alternatives are to call get_users() to get all members of the blog, or to trigger a usermeta fetch. Either one is pretty heavy — all for a CSS class that can be conditionally added by a filter. While the class is cool, implementing it is doable in a plugin as needed. Strongly suggesting wontfix.
#10
@
11 years ago
- Milestone 3.7 deleted
- Resolution set to wontfix
- Status changed from reopened to closed
As noted above, this can be done using comment_class
filter if needed:
function add_by_blog_user_class_16944( $classes, $class, $comment_id ) { $comment = get_comment( $comment_id ); if ( ! is_multisite() || is_user_member_of_blog( $comment->user_id ) ) $classes[] = 'by-blog-user'; return $classes; } add_filter( 'comment_class', 'add_by_blog_user_class_16944', 10, 3 );
Preliminary diff