#52322 closed enhancement (fixed)
Add comment / comment id param to get_comment_time
Reported by: | spacedmonkey | Owned by: | audrasjb |
---|---|---|---|
Milestone: | 6.2 | Priority: | normal |
Severity: | normal | Version: | 1.5 |
Component: | Comments | Keywords: | good-first-bug has-patch commit add-to-field-guide |
Focuses: | Cc: |
Description
Bring get_comment_time inline with get_comment_date and add a comment / comment id param to pass comment id into the function.
Attachments (3)
Change History (23)
#2
follow-up:
↓ 8
@
4 years ago
Thanks for the patch! Some notes:
- The new parameter should be added at the end. Adding it after
$format
matchesget_comment_date()
, but is not feasible in practice, as it would break backward compatibility. - The DocBlock should be aligned per the documentation standards and would also need a @since note.
comment_time()
would probably need a similar change for consistency.
#3
@
4 years ago
Thanks for the guidance and the feedback!
I updated 'get_comment_time' to reflect the changes you mentioned. Still trying to figure out the best way to change 'comment_time' for consistency. Attaching an updated patch file to make sure I am on the right track.
Thanks very much for your patience in helping me navigate the coding standards.
This ticket was mentioned in PR #2646 on WordPress/wordpress-develop by DSGND.
2 years ago
#4
Check if function get_comment_id is null before executing it.
Trac ticket: https://core.trac.wordpress.org/ticket/52322
#5
@
2 years ago
Hi,
I've just submitted a #PR2646 to check if get_comment_id
is not null to avoid an error when executing.
(It's my first contribution)
#6
@
23 months ago
- Keywords needs-refresh changes-requested added
- Owner set to audrasjb
- Status changed from new to reviewing
Thanks for the PR @d-signed! I added two feedbacks in your PR :)
#7
@
23 months ago
- Milestone changed from Awaiting Review to 6.2
- Version set to 1.5
Moving for 6.2 consideration.
#8
in reply to:
↑ 2
@
22 months ago
Replying to SergeyBiryukov:
Thanks for the patch! Some notes:
- The new parameter should be added at the end. Adding it after
$format
matchesget_comment_date()
, but is not feasible in practice, as it would break backward compatibility.- The DocBlock should be aligned per the documentation standards and would also need a @since note.
comment_time()
would probably need a similar change for consistency.
Yes, I agree with @SergeyBiryukov that we need a similar change in comment_time()
for consistency. Also, we can add the same extra parameter $comment_ID
on the get_comment_time
filter so that developer can get a direct comment id instead of getting it from the $comment
object.
#9
@
22 months ago
- Keywords needs-refresh changes-requested removed
I submitted a new patch for this 52322.3, refreshing the one from @travisaxton (new comparison against trunk
) and with the additions mentioned by @rudlinkon and @SergeyBiryukov. I added $comment_ID
to comment_time()
for consistency and to the filter get_comment_time
as well, and @since
notes in both comment_time()
and get_comment_time()
.
This is my first contribution.
This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.
20 months ago
#11
@
20 months ago
- Keywords changes-requested added
This ticket was discussed in the recent bug scrub.
Thanks @spacedmonkey for the ticket!
@d-signed There are a few reviews that need to be changed.
Props to @costdev
#12
@
20 months ago
There needs to be a check to see if the comment exists.
$comment = get_comment( $comment_ID );
A check like this
$comment = get_comment( $comment_id );
if ( ! $comment ) {
return '';
}
We may even need to do this
if ( !$comment || 'trash' === get_post_status( $comment->comment_post_ID ) ) {
This ticket was mentioned in Slack in #core by costdev. View the logs.
20 months ago
#14
@
20 months ago
- Keywords commit added; changes-requested removed
This ticket was discussed during the bug scrub. This looks ready for commit
consideration. Adding the appropriate keyword. JB agrees that the suggested docs change on the PR can be made during commit.
Additional props: @audrasjb
@audrasjb commented on PR #2646:
19 months ago
#15
I added one commit to the PR to fix a WPCS issue
This ticket was mentioned in Slack in #core by costdev. View the logs.
19 months ago
@audrasjb commented on PR #2646:
19 months ago
#18
committed in https://core.trac.wordpress.org/changeset/55284
I've submitted a possible solution for the 'get_comment_time' function. This is my first submission for WordPress Core so I apologize if I have made any mistakes with the Trac workflow.