WordPress.org

Make WordPress Core

Opened 20 months ago

Last modified 7 weeks ago

#24826 new enhancement

Add __construct function to the "WP_Comment_Query" Class

Reported by: ramiy Owned by:
Milestone: 4.2 Priority: normal
Severity: normal Version: 3.5
Component: Comments Keywords: has-patch
Focuses: Cc:

Description

Add PHP5 construct function to the comments query class, just like we have constructor functions on WP_Query and WP_User_Query classes.

Attachments (3)

comment.php.diff (3.1 KB) - added by westonruter 19 months ago.
tests-comment-query.php.patch (1.1 KB) - added by westonruter 19 months ago.
24826.diff (4.1 KB) - added by westonruter 8 months ago.
Refreshed patch. PR: https://github.com/x-team/wordpress-develop/pull/24

Download all attachments as: .zip

Change History (9)

comment:1 @DrewAPicture20 months ago

  • Cc xoodrew@… added
  • Version changed from trunk to 3.1

@westonruter19 months ago

comment:2 @westonruter19 months ago

  • Cc weston@… added
  • Keywords has-patch added; needs-patch removed
  • Severity changed from major to normal
  • Version changed from 3.1 to trunk

Add WP_Comment_Query::__construct() for parity with WP_Query::__construct()

Also:
Add WP_Comment_Query::get_comments() for parity with WP_Query::get_posts()
Add WP_Comment_Query::$comments for parity with WP_Query::$posts
Declare WP_Comment_Query::$query_vars which was previously implicit
Add parse_comment_query action for parity with parse_query in WP_Query.

Relates to #15032

Patches are also on GitHub at:
https://github.com/x-team/WordPress/tree/24826
https://github.com/x-team/WordPress/commit/db6105cbaf60ca20501fafea29b0f8277ed03cd3

Passes unit tests for comment group; also added a new test for the changes to WP_Comment_Query (attached).

Last edited 19 months ago by westonruter (previous) (diff)

comment:3 @SergeyBiryukov15 months ago

  • Version changed from trunk to 3.5

comment:4 @wonderboymusic8 months ago

  • Keywords needs-refresh added; 2nd-opinion dev-feedback removed
  • Milestone changed from Awaiting Review to Future Release

This does improve the class, but the patch currently explodes

comment:5 @westonruter8 months ago

  • Keywords needs-refresh removed

In 24826.diff merged core patch and unit test patch into one, and fixed conflicts.

comment:6 @wonderboymusic7 weeks ago

  • Milestone changed from Future Release to 4.2
Note: See TracTickets for help on using tickets.