Changeset 10043
- Timestamp:
- 08/11/2015 04:54:03 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-user-query.php
r10012 r10043 596 596 597 597 // Match up to the user ids from the main query 598 foreach ( $this->user_ids as $ uid ) {598 foreach ( $this->user_ids as $key => $uid ) { 599 599 if ( isset( $r[ $uid ] ) ) { 600 600 $this->results[ $uid ] = $r[ $uid ]; … … 603 603 // (as opposed to 'ID') property 604 604 $this->results[ $uid ]->id = $uid; 605 606 // remove user ID from original user_ids property 607 } else { 608 unset( $this->user_ids[ $key ] ); 605 609 } 606 610 } -
trunk/tests/phpunit/testcases/core/class-bp-user-query.php
r9976 r10043 67 67 } 68 68 69 /** 70 * @group user_ids 71 */ 72 public function test_bp_user_query_user_ids_with_invalid_user_id() { 73 $now = time(); 74 $u1 = $this->factory->user->create(); 75 $u2 = $this->factory->user->create(); 76 77 // invalid user ID 78 $u3 = $u2 + 1; 79 80 $old_user = get_current_user_id(); 81 $this->set_current_user( $u1 ); 82 83 // pass 'user_ids' to user query to trigger this bug 84 $q = new BP_User_Query( array( 85 'user_ids' => array( $u2, $u3 ) 86 ) ); 87 88 // $q->user_ids property should now not contain invalid user IDs 89 $this->assertNotContains( $u3, $q->user_ids ); 90 91 // clean up 92 $this->set_current_user( $old_user ); 93 } 94 69 95 public function test_bp_user_query_sort_by_popular() { 70 96 $u1 = $this->factory->user->create();
Note: See TracChangeset
for help on using the changeset viewer.