Opened 5 years ago

Closed 5 years ago

Last modified 7 months ago

#7635 closed enhancement (fixed)

Threaded Comments

Reported by: ryan Owned by: anonymous
Priority: normal Milestone: 2.7
Component: General Version:
Severity: normal Keywords: blessed
Cc:

Description

Support threaded comments.

Attachments (14)

7635.diff (8.7 KB) - added by ryan 5 years ago.
7635.2.diff (10.2 KB) - added by ryan 5 years ago.
Add style and callback args to wp_list_comments(), add cancel_comment_reply_link().
7635.3.diff (10.3 KB) - added by ryan 5 years ago.
Refresh for current trunk
7635.4.diff (2.4 KB) - added by DD32 5 years ago.
7635.5.diff (2.4 KB) - added by DD32 5 years ago.
comment-styling-kubrick-rev1.patch (2.6 KB) - added by noel 5 years ago.
Comment styling for kubrick, take 1
commentstyling-rev2.patch (1.6 KB) - added by noel 5 years ago.
Comment styling
show-reply-via-jquery.patch (1.9 KB) - added by Viper007Bond 5 years ago.
Hide threaded reply link, show via jQuery
comment-reply-jquery.patch (2.3 KB) - added by Viper007Bond 5 years ago.
Move all of comment-reply.js to jQuery + trim filesize in half
reply-to-comments-nojs.patch (4.2 KB) - added by Viper007Bond 5 years ago.
Foolin' around with no-JS fallback for replying to comments, may not be ready for commit
separate_comments.diff (1.9 KB) - added by ryan 5 years ago.
Add separate_comments flag to comments_template()
avatar-size.diff (940 bytes) - added by Otto42 5 years ago.
Patch to add avatar_size parameter
7635.6.patch (2.7 KB) - added by azaozz 5 years ago.
threaded-comments-options-simplification.patch (2.7 KB) - added by Viper007Bond 5 years ago.
Move depth to dropdown per Matt's request + tweak translation stuff (translation stuff needs review)

Download all attachments as: .zip

Change History (69)

comment:2   ryan5 years ago

Patch introduces wp_list_comments(), which uses a new comment walker class. A custom class can be passed to wp_list_comments() if someone doesn't like the layout in the default class. Ideally, wp_list_comments() would be very customizable so that replacing the walker class isn't necessary.

Default theme patched to use wp_list_comments() and friends.

Two new JS functions ripped from Threaded Comments plugin and cut down to the minimum. The thread expand/collapse from the plugin is not supported and probably won't be a core feature.

This is very, very rough and ugly. First draft.

ryan5 years ago

  • Type changed from defect to enhancement

ryan5 years ago

Add style and callback args to wp_list_comments(), add cancel_comment_reply_link().

ryan5 years ago

Refresh for current trunk

comment:4   ryan5 years ago

Thoughts on the patch? Does it seem like a good approach to go forward with? If so, I can commit and we can go about getting the bundled themes using the new API and looking decent.

comment:5   ryan5 years ago

(In [8869]) wp_list_comments() and threaded comment support. First cut. see #7635

comment:6   ryan5 years ago

Todo: Reply links should be hidden by default and enabled with JS.

comment:7   ryan5 years ago

Default theme needs styling: Align gravatars on right or move to left. Fix alt for child comments. Fix overlap when replying.

It's pretty good, although I think some settings in the admin area (easy enable/disable and perhaps depth of comments spring to mind) might be something to consider for some users.

comment:9   ryan5 years ago

Any options are dependent on if the theme supports threaded comments. If we put options in the admin they won't do anything without theme support. That's not so nice. Maybe we can make it easy for themes to add these settings to a theme options page.

Notes:

  • supports ol|ul|div style
  • if callback registered for start_el, end_el is assumed to have been taken care of by start_el callback
  • "class="classname"" html fixed (was quoted)
  • Creates Valid XHTML for nested lists, HOWEVER:
    • Nested lists must be within their own <li>, The result is that nested lists get a bulletpoint.. You can hide the bullet, but with a <ul> mearly hiding it results in a number being skiped.
    • So: Valid XHTML & dodgy numbers with UL, or Invalid XHTML but good list points?

DD325 years ago

So: Valid XHTML & dodgy numbers with UL, or Invalid XHTML but good list points?

It may be i'm mistaken here.

I was certain that a nested list in XHTML had to be

<li>Parent..</li>
<li><ul><li>Child</li></ul></li>

(ie. in its own holder)

But it appears thats not the case, the UL can go into the parent list, So this means that a bit more trickery needs to be done.. I'll have a furthur play with it.

Eugh, Turned out it was due to the my callback change that buggered it up.

Patch is the same as before, But adds end-callback for overriding end_el(), which is needed if the callback requires something other than </div> or </li>

Also creates valid xhtml now.

DD325 years ago

(In [8876]) Threaded comments improvements from DD32. see #7635

(In [8877]) Add respondID and respondRoot args to cancelCommentReply(). see #7635

comment:15 follow-up: ↓ 16   ryan5 years ago

(In [8878]) Add depth handling to comment_reply_link(). see #7635

comment:16 in reply to: ↑ 15   DD325 years ago

Replying to ryan:

(In [8878]) Add depth handling to comment_reply_link(). see #7635

 	851	 
 	852	    if ( 0 == $args['depth'] || $args['max_depth'] < $args['depth'] ) 
851	853	 
852	854	    extract($args, EXTR_SKIP); 

Looks like you've missed a return there?

(In [8897]) Add type argument to wp_list_comments(). Make comments arg optional. Introduce separate_comments(). see #7635

(In [8898]) Add missing return. Props DD32. see #7635

Added a type argument to wp_list_comments(). Type can be comment, pingback, trackback, or pings. pings includes both tracbacks and pingbacks. Comments are separated with separate_comments(). Themes can call this themselves instead of relying on wp_list_comments() to do it if desired.

comment:20 follow-up: ↓ 21   Speedboxer5 years ago

How about integrating threaded comments into the reply feature in the comments admin? So that, if the selected theme has threaded comments implemented, replys to comments will be threaded under the parent comment.

comment:21 in reply to: ↑ 20   Speedboxer5 years ago

Replying to Speedboxer:

How about integrating threaded comments into the reply feature in the comments admin? So that, if the selected theme has threaded comments implemented, replys to comments will be threaded under the parent comment.

Nevermind, it seems to do this already. :)

(In [8941]) Fix depth inversion. see #7635

(In [8961]) First cut of comment paging. Add paging and threading settings. see #7769 #7635

noel5 years ago

Comment styling for kubrick, take 1

Maybe we should apply alt styling to entire threads instead of individual comments or drop alt styling altogether. Or, put comment_class() on the comment div instead of the li for list mode.

(In [8962]) Add thread alt classes. see #7635

(In [8963]) s/list/ul/ see #7635

noel5 years ago

Comment styling

(In [8971]) Comment styling for default theme. Props noel. see #7635

I'm converting my comments.php to use the new stuff. Tricky-ish.

Question: How can I make it default to the last page of comments instead of the first page?

Bug: If you're using this, the gravatar size is fixed at 32 px with no way to adjust it other than editing the core code.

What's best? A filter? A global? A parameter to wp_list_comments()?

Parameter or perhaps an option in the admin area. Filters and globals are a pain for the average user.

Hide threaded reply link, show via jQuery

(In [9037]) Hide reply link by default. Enable with JS. Props Viper007Bond. see #7635

(In [9039]) If comment type is empty set it to 'comment'. see #7635

A good point was brought up.. If you can do wp_list_comments('type=pings'); or what have you, then it would be nice to know if there are any comments of that type before you call it. Like have_comments('type=pings') or something similar.

This is problematic because as near as I can see, the $wp_query->comments_by_type doesn't get setup until you have already called wp_list_comments with a non-all type. Perhaps the query should always separate the comments when they are pulled out of the DB.

It'd be nice if the comment pages had pretty URLs.

Move all of comment-reply.js to jQuery + trim filesize in half

(In [9082]) Move all of comment-reply.js to jQuery + trim filesize in half, props Viper007Bond, see #7635

Foolin' around with no-JS fallback for replying to comments, may not be ready for commit

ryan5 years ago

Add separate_comments flag to comments_template()

Patch adds flag to comments_template() for requesting comments to be separated by type.

(In [9092]) Add arg to comments_template() for requesting separating comments by type. see #7635

(In [9093]) before and after for comment_reply_link(). see #7635

Otto425 years ago

Patch to add avatar_size parameter

comment:39 follow-up: ↓ 40   Otto425 years ago

Here's a patch to add an avatar_size parameter to wp_list_comments(). It will let you have the avatar any size you like, or not have it at all with it set to zero. Tested on latest trunk and it works fine.

comment:40 in reply to: ↑ 39 ; follow-up: ↓ 41   josephscott5 years ago

Replying to Otto42:

Here's a patch to add an avatar_size parameter to wp_list_comments(). It will let you have the avatar any size you like, or not have it at all with it set to zero. Tested on latest trunk and it works fine.

The get_avatar() call already checks the show_avatar option to determine when avatars should be shown.

comment:41 in reply to: ↑ 40   Otto425 years ago

Replying to josephscott:

Replying to Otto42:
The get_avatar() call already checks the show_avatar option to determine when avatars should be shown.

This lets the theme override that, if desired.

azaozz5 years ago

Attempting to make the js a bit more generic so it can be used in most themes without changes.

(In [9112]) No-JS mode for replying to comments and some improvements/cleanup of comment-reply.js, includes patch by Viper007Bond, see #7635

The above patch makes several changes: introduces 2 new template tags used to allow replying without js: comment_parent_field() outputs the hidden input field and comment_form_title() outputs a different title for the form when replying (optional).

Changes: cancel_comment_reply_link() takes only one argument text = ' ', the rest is set from js. The DIV surrounding it shouldn't be hidden (for supporting no-js mode) and is optional.

(In [9113]) No jQuery requirement for comment-reply.js, see #7635

(In [9114]) Use no-js reply on error in comment-reply.js, see #7635

Move depth to dropdown per Matt's request + tweak translation stuff (translation stuff needs review)

(In [9175]) comment_id_fields(). see #7635

The Walker_Comment's start_el() function needs to pass all the $args, merged with the three fields it must send anyway, down to the comment_reply_link function, making those fields available to be set in the calls to higher level functions.

For example, when calling wp_list_comments, there's currently no way to set the text of the "Reply" link. If the $args were passed along, one could simply add a reply_text parameter to the call.

Also, there's still no way to set the avatar_size. Can we get that patch added in already? Having to hack the code manually every time I svn up is getting annoying.

(In [9206]) Threaded comments options cleanup. Props Viper007Bond. see #7635

(In [9207]) Add avatar_size arg. Props Otto42. see #7635

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

Closing this ticket as fixed. Otto42 can you start a new ticket with patch for your args request?

ryan: Done. See #7901.

Nothing.

Last edited 7 months ago by SergeyBiryukov (previous) (diff)

*spam removed*

Last edited 7 months ago by Otto42 (previous) (diff)
Note: See TracTickets for help on using tickets.