Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#42380 closed enhancement (wontfix)

Add comment url filter to comment list table

Reported by: danieltj Owned by: ashokrd2013
Priority: normal Milestone:
Component: Comments Version: 4.8.2
Severity: normal Keywords: good-first-bug has-patch needs-testing
Cc: Focuses:

Description

In class-wp-comments-list-table.php on line 684 we get the author url like so:

$author_url = get_comment_author_url( $comment );

Even though slightly further down there is a filter for the comment author email address, there isn't a filter for the comment author url. Directly below the code listed above, there should be another filter (for completeness if not for anything else).

I'd suggest something like this:

$author_url = apply_filters( 'comment_website', $author_url, $comment );

This would then allow the author url to be altered with the added bonus of the comment object for extra flexibility, much like the email address.

Attachments (1)

42380.patch​ (618 bytes ) - added by ashokrd2013 9 years ago.

Download all attachments as: .zip

Change History (7)

#1 @danieltj
9 years ago

  • Keywords needs-patch good-first-bug added

#2 @ashokrd2013
9 years ago

  • Keywords has-patch added; needs-patch removed

#3 @ashokrd2013
9 years ago

  • Keywords needs-testing added

#4 @birgire
9 years ago

Thanks for the patch @ashokrd2013

In the Core Contributor Handbook there's a good description how to document filters:

​https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#4-hooks-actions-and-filters

but I noticed that the function get_comment_author_url() contains the following filter:

 /**
  * Filters the comment author's URL.
  *
  * @since 1.5.0
  * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
  *
  * @param string     $url        The comment author's URL.
  * @param int        $comment_ID The comment ID.
  * @param WP_Comment $comment    The comment object.
  */
  return apply_filters( 'get_comment_author_url', $url, $id, $comment );

https://core.trac.wordpress.org/browser/tags/4.9.1/src/wp-includes/comment-template.php#L302

#5 @DrewAPicture
9 years ago

  • Owner set to ashokrd2013
  • Status new → assigned

Assigning to mark the good-first-bug as "claimed".

#6 @johnbillion
9 years ago

  • Milestone Awaiting Review
  • Resolution → wontfix
  • Status assigned → closed

As per comment:4, there's already the get_comment_author_url filter that can be used.

Feel free to reopen if this doesn't address your needs.

Note: See TracTickets for help on using tickets.