Opened 3 years ago
Last modified 2 weeks ago
#14856 new enhancement
Add an $args parameter to comment_text filter
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.6 |
| Component: | Comments | Version: | |
| Severity: | normal | Keywords: | 3.2-early has-patch |
| Cc: | nacin |
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 (7)
Change History (16)
simonwheatley — 3 years ago
simonwheatley — 3 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.
- Keywords 3.2-early added; needs-testing removed
- Milestone changed from Awaiting Review to Future Release
Extra context for filters++;
- Keywords needs-refresh added; needs-testing removed
I'm getting a "malformed patch" error.
- Keywords needs-refresh removed
I refreshed the patch. It should apply cleanly now.
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?
wonderboymusic — 4 months ago
comment:7
wonderboymusic — 4 months ago
- Milestone changed from Future Release to 3.6
Refreshed against trunk
DrewAPicture — 2 weeks ago
comment:9
DrewAPicture — 2 weeks 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.

Small test plugin