Make WordPress Core

Opened 14 years ago

Closed 11 years ago

Last modified 6 years ago

#14856 closed enhancement (fixed)

Add an $args parameter to comment_text filter

Reported by: simonwheatley's profile simonwheatley Owned by: wonderboymusic's profile wonderboymusic
Milestone: 3.7 Priority: normal
Severity: normal Version:
Component: Comments Keywords: 3.2-early has-patch
Focuses: Cc:

Description

When using the comment_text filter, there are times when the context provided by $args would be extremely useful. For example to know the depth of the commen. I propose adding an additional parameter for comment_text to add the $args.

I've incorporated the proposed $comment_ID parameter from #14261, which looks to add a $comment_id parameter to the same filter, in the hope that this is helpful... let me know if not and I'll refactor.

I've included a small plugin to demo the use and prove the new parameters are working, and the diff for a small tweak to Twenty Ten v1.1 which is needed to use this plugin with that theme.

Attachments (9)

test-comment-text-args.php (1.6 KB) - added by simonwheatley 14 years ago.
Small test plugin
twenty_ten tweak to demo new param.diff (675 bytes) - added by simonwheatley 14 years ago.
comment_text args param.diff (2.1 KB) - added by simonwheatley 14 years ago.
Now with less error_log calls
14856.patch (1.8 KB) - added by jorbin 14 years ago.
refresh (without trailing whitespace this time)
14856.diff (2.0 KB) - added by wonderboymusic 12 years ago.
14856.1.diff (1.8 KB) - added by ericlewis 12 years ago.
14856.2.diff (2.1 KB) - added by DrewAPicture 12 years ago.
14856.3.diff (2.9 KB) - added by DrewAPicture 11 years ago.
docs review + filter docs
14856.4.diff (3.1 KB) - added by DrewAPicture 11 years ago.
Add defaults to the functional docs.

Download all attachments as: .zip

Change History (25)

@simonwheatley
14 years ago

Small test plugin

#1 @hakre
14 years ago

Related: #14681


some feedback:

  • comment_text args param.diff contains a debug line: error_log( ... ).
  • instead of passing $args (which looks okay to me so far, could not completely dig into there), another idea might be to pass the $comment object to the filter as well as it is done with posts.

@simonwheatley
14 years ago

Now with less error_log calls

#2 @dd32
14 years ago

  • Keywords 3.2-early added; needs-testing removed
  • Milestone changed from Awaiting Review to Future Release

Extra context for filters++;

#3 @dd32
14 years ago

  • Keywords needs-testing added; dev-feedback removed

#4 @scribu
14 years ago

  • Keywords needs-refresh added; needs-testing removed

I'm getting a "malformed patch" error.

#5 @jorbin
14 years ago

  • Keywords needs-refresh removed

I refreshed the patch. It should apply cleanly now.

@jorbin
14 years ago

refresh (without trailing whitespace this time)

#6 @hakre
14 years ago

Just a small thing: in function comment_text() the new args argument is not optional. And can you make $args default values array() instead of NULL for both functions?

#7 @wonderboymusic
12 years ago

  • Milestone changed from Future Release to 3.6

Refreshed against trunk

@ericlewis
12 years ago

#9 @DrewAPicture
12 years ago

14856.2.diff fixes a typo in the Walker_Comment::comment() change and clarifies the docblock changes.

The passed args work as expected with the filters.

#10 @ocean90
12 years ago

  • Milestone changed from 3.6 to Future Release

#11 @wonderboymusic
11 years ago

  • Milestone changed from Future Release to 3.7

#12 follow-up: @wonderboymusic
11 years ago

@DrewAPicture - please review this again

@DrewAPicture
11 years ago

docs review + filter docs

#13 in reply to: ↑ 12 @DrewAPicture
11 years ago

Replying to wonderboymusic:

@DrewAPicture - please review this again

14856.3.diff refreshes the inline docs per standards and adds filter docs for the get_comment_text and comment_text filters.

@DrewAPicture
11 years ago

Add defaults to the functional docs.

#14 @DrewAPicture
11 years ago

14856.4.diff adds defaults to the functional docs.

#15 @wonderboymusic
11 years ago

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

In 25555:

Add an $args parameter to comment_text and get_comment_text filters. Adds filter docs. Improve docblocks for get_comment_text() and comment_text().

Props simonwheatley, ericlewis, DrewAPicture.
Fixes #14856.

This ticket was mentioned in Slack in #core-editor by mapk. View the logs.


6 years ago

Note: See TracTickets for help on using tickets.