Changeset 12866
- Timestamp:
- 03/17/2021 08:35:54 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-invitation.php
r12547 r12866 423 423 * Only create a where statement if something less than "all" has been 424 424 * specifically requested. 425 */ 425 */ 426 426 if ( ! empty( $args['invite_sent'] ) && 'all' !== $args['invite_sent'] ) { 427 427 if ( $args['invite_sent'] == 'draft' ) { … … 444 444 if ( ! empty( $args['search_terms'] ) ) { 445 445 $search_terms_like = '%' . bp_esc_like( $args['search_terms'] ) . '%'; 446 $where_conditions['search_terms'] = $wpdb->prepare( "( class LIKE %s )", $search_terms_like, $search_terms_like );446 $where_conditions['search_terms'] = $wpdb->prepare( '( invitee_email LIKE %s OR content LIKE %s )', $search_terms_like, $search_terms_like ); 447 447 } 448 448 -
trunk/tests/phpunit/testcases/core/invitations.php
r12428 r12866 174 174 $this->set_current_user( $old_current_user ); 175 175 } 176 176 177 177 public function test_bp_invitations_add_request_vanilla() { 178 178 $old_current_user = get_current_user_id(); … … 288 288 } 289 289 290 public function test_bp_invitations_get_by_search_terms() { 291 $old_current_user = get_current_user_id(); 292 293 $u1 = $this->factory->user->create(); 294 $u2 = $this->factory->user->create(); 295 $this->set_current_user( $u1 ); 296 297 $invites_class = new BPTest_Invitation_Manager_Extension(); 298 299 // Create an invitation. 300 $i1_args = array( 301 'user_id' => $u2, 302 'inviter_id' => $u1, 303 'item_id' => 1, 304 'content' => 'Sometimes, the mystery is enough.', 305 ); 306 $i1 = $invites_class->add_invitation( $i1_args ); 307 $invites_class->send_invitation_by_id( $i1 ); 308 309 // Create an invitation that uses an email address. 310 $i2_args = array( 311 'invitee_email' => 'findme@buddypress.org', 312 'inviter_id' => $u1, 313 'item_id' => 1, 314 ); 315 $i2 = $invites_class->add_invitation( $i2_args ); 316 $invites_class->send_invitation_by_id( $i2 ); 317 318 $get_invites = array( 319 'search_terms' => 'mystery', 320 'fields' => 'ids', 321 ); 322 $invites = $invites_class->get_invitations( $get_invites ); 323 $this->assertEqualSets( array( $i1 ), $invites ); 324 325 $get_invites = array( 326 'search_terms' => 'findme', 327 'fields' => 'ids', 328 ); 329 $invites = $invites_class->get_invitations( $get_invites ); 330 $this->assertEqualSets( array( $i2 ), $invites ); 331 332 $this->set_current_user( $old_current_user ); 333 } 334 290 335 }
Note: See TracChangeset
for help on using the changeset viewer.