Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#8287 closed enhancement (fixed)

More get_comment_link() improvements

Reported by: viper007bond's profile Viper007Bond Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.7
Component: Comments Keywords: has-patch
Focuses: Cc:

Description

  1. Don't force theme authors to pass the page argument value to get_comment_link() in their comment walker. We can just do it ourselves behind the scenes. This simplifies things a lot.
  1. Replace get_comment_link()'s second parameter with an $args allowing you to pass things like type (it's backwards compatible). Basically if you know you're going to be passing a type to wp_list_comments() (for example comment) and need to use get_comment_link() outside of the loop (i.e. a custom recent comments), pass the same type to get_comment_link() and you should end up with a proper page number. Note the default recent comments widget will still produce the wrong page numbers if you pass a type to wp_list_comments().
  1. Change number 2 required updating get_page_of_comment() to support all these extra args.

Attachments (2)

8287.patch (5.7 KB) - added by Viper007Bond 16 years ago.
8287.2.patch (6.4 KB) - added by Viper007Bond 16 years ago.
The default comment Walker doesn't need to pass the page anymore either

Download all attachments as: .zip

Change History (4)

@Viper007Bond
16 years ago

#1 @Viper007Bond
16 years ago

If any plugin to theme authors were directly using get_page_of_comment() already (dunno why they would as it's mainly an internal function), then this patch may break their code due to the changed parameters.

That's unlikely though and 2.7 hasn't gone gold yet though so I figured it wasn't worth having backwards compatibility on an internal, new function.

get_comments_link() is however used by theme authors so it's new parameters are backwards compatible.

@Viper007Bond
16 years ago

The default comment Walker doesn't need to pass the page anymore either

#2 @markjaquith
16 years ago

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

(In [9808]) Improvements for get_comment_link() from Viper007Bond. fixes #8287

Note: See TracTickets for help on using tickets.