Skip to:

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1763 closed enhancement (fixed)

Additional reply classes

Reported by: jaredatch's profile jaredatch Owned by: jaredatch's profile jaredatch
Milestone: 2.1 Priority: normal
Severity: normal Version: 2.0
Component: Front-end Keywords:


Right now the default div for a reply looks like:

<div id="post-8" class="post-8 reply type-reply status-publish hentry even bbp-parent-forum-5 bbp-parent-topic-7">

It would be pretty nifty if we could add a few classes if the conditionals are met. Off the top of my head:

  • 'topic-author', could be used to highly responses from the topic's original author
  • 'forum-admin' / 'forum-moderator' - style admin/moderator replies to stand out
  • 'user-%username%' - could be used to style/highly specific users

There might be some other good ones, this is what I came up with on first pass.

As per

Attachments (1)

1763.diff (1.0 KB) - added by jaredatch 12 years ago.

Download all attachments as: .zip

Change History (7)

#1 @jaredatch
12 years ago

  • Keywords needs-patch added; 2nd-opinion removed
  • Milestone changed from Awaiting Review to Future Release
  • Owner set to jaredatch

12 years ago

#2 @jaredatch
12 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

Patch attached, tacks on the following to reply classes:

user-%username% - currently using str_replace to remove spaces in favor for hyphens, this doesn't seem smart. Maybe just use user ID, eg user-1? Either way they can target specific users with it via CSS.

topic-author - if reply author is the same as original topic author

forum-admin or forum-moderator - think that says it all. Right now it's in an if-statement that looks out of place in the function, but I wasn't sure where else to put it.

See what you think :)

#3 @johnjamesjacoby
12 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [3785]) CSS class changes

  • Add user-id and topic-author to reply class
  • Add user-id to topic class
  • Run reply classes through array_filter()
  • Fixes #1763
  • Props jaredatch

#4 @johnjamesjacoby
12 years ago

  • Milestone changed from Future Release to 2.1

#5 @johnjamesjacoby
12 years ago

  • Keywords has-patch needs-testing removed

Checking each user's role and caps ended up to be a performance hit of potentially two queries per post. Not willing to take that hit yet, so only included the ones that were previously cached.

#6 @jaredatch
12 years ago

Did you use debug bar to test/bench that? I'm curious so I can save you some testing when I submit future patches :P

Note: See TracTickets for help on using tickets.