Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#27064 closed enhancement (fixed)

Allow user_id to accept an array of IDs for WP_Comment_Query

Reported by: mordauk Owned by: nacin
Priority: normal Milestone: 3.9
Component: Comments Version: 3.9
Severity: normal Keywords: has-patch commit
Cc: Focuses:

Description

As the user who submitted this support ticket wanted, it seems perfectly reasonable to me that we should allow an array of user IDs to be passed to the user_id parameter of WP_Comment_Query in order to retrieve comments by multiple users.

I'd propose that the user_id allow either an integer or an array to be passed.

Attachments (5)

27064.patch (731 bytes ) - added by mordauk 13 years ago.
Allow user_id to be passed as an array to WP_Comment_Query
27064-2.patch (732 bytes ) - added by mordauk 13 years ago.
Refresh patch for spacing
27064-tests.patch (1.5 KB ) - added by mordauk 13 years ago.
Basic unit tests for "user_id" parameter of get_comments()
27064-tests-2.patch (1.5 KB ) - added by mordauk 13 years ago.
Fixed failed assertions
27064-tests-3.patch (1.1 KB ) - added by mordauk 13 years ago.
More concise unit tests, thanks to markjaquith for his feedback

Download all attachments as: .zip

Change History (12)

@mordauk
13 years ago

Allow user_id to be passed as an array to WP_Comment_Query

#1 @nacin
13 years ago

Works for me. We should put a space between IN and (.

Would also be cool if a simple user test ended up in tests/phpunit/tests/comment/query.php.

#2 @nacin
13 years ago

  • Keywords has-patch commit needs-unit-tests added
  • Milestone Awaiting Review3.9

#3 @mordauk
13 years ago

Sure thing, I'll upload a new patch in a few minutes.

@mordauk
13 years ago

Refresh patch for spacing

@mordauk
13 years ago

Basic unit tests for "user_id" parameter of get_comments()

#4 @mordauk
13 years ago

Patches updated. I don't have phpunit on this computer so the unit tests are untested (ha), but I think they will work.

I wasn't completely sure on the best way to write the tests for this one, so let me know if you'd prefer to see something different.

@mordauk
13 years ago

Fixed failed assertions

#5 @mordauk
13 years ago

I've now tested and (after updating the patch) confirmed the unit tests pass now.

@mordauk
13 years ago

More concise unit tests, thanks to markjaquith for his feedback

#6 @mordauk
13 years ago

  • Keywords needs-unit-tests removed

#7 @nacin
12 years ago

  • Owner set to nacin
  • Resolutionfixed
  • Status newclosed

In 27258:

Allow user_id to be an array of IDs in WP_Comment_Query.

props mordauk.
fixes #27064.

Note: See TracTickets for help on using tickets.