Changeset 12547 for trunk/src/bp-core/classes/class-bp-invitation.php
- Timestamp:
- 01/29/2020 09:43:16 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-invitation.php
r12428 r12547 188 188 do_action_ref_array( 'bp_invitation_before_save', array( &$this ) ); 189 189 190 // Update 190 // Update. 191 191 if ( ! empty( $this->id ) ) { 192 192 $result = self::_update( $data, array( 'ID' => $this->id ), $data_format, array( '%d' ) ); 193 // Insert 193 // Insert. 194 194 } else { 195 195 $result = self::_insert( $data, $data_format ); 196 196 } 197 197 198 // Set the invitation ID if successful 198 // Set the invitation ID if successful. 199 199 if ( ! empty( $result ) && ! is_wp_error( $result ) ) { 200 200 global $wpdb; … … 215 215 do_action_ref_array( 'bp_invitation_after_save', array( &$this ) ); 216 216 217 // Return the result 217 // Return the result. 218 218 return $retval; 219 219 } … … 347 347 $where = ''; 348 348 349 // id 349 // id. 350 350 if ( false !== $args['id'] ) { 351 351 $id_in = implode( ',', wp_parse_id_list( $args['id'] ) ); … … 353 353 } 354 354 355 // user_id 355 // user_id. 356 356 if ( ! empty( $args['user_id'] ) ) { 357 357 $user_id_in = implode( ',', wp_parse_id_list( $args['user_id'] ) ); … … 365 365 } 366 366 367 // invitee_email 367 // invitee_email. 368 368 if ( ! empty( $args['invitee_email'] ) ) { 369 369 if ( ! is_array( $args['invitee_email'] ) ) { … … 382 382 } 383 383 384 // class 384 // class. 385 385 if ( ! empty( $args['class'] ) ) { 386 386 if ( ! is_array( $args['class'] ) ) { … … 399 399 } 400 400 401 // item_id 401 // item_id. 402 402 if ( ! empty( $args['item_id'] ) ) { 403 403 $item_id_in = implode( ',', wp_parse_id_list( $args['item_id'] ) ); … … 405 405 } 406 406 407 // secondary_item_id 407 // secondary_item_id. 408 408 if ( ! empty( $args['secondary_item_id'] ) ) { 409 409 $secondary_item_id_in = implode( ',', wp_parse_id_list( $args['secondary_item_id'] ) ); … … 411 411 } 412 412 413 // type413 // Type. 414 414 if ( ! empty( $args['type'] ) && 'all' !== $args['type'] ) { 415 415 if ( 'invite' == $args['type'] || 'request' == $args['type'] ) { … … 432 432 } 433 433 434 // accepted434 // Accepted. 435 435 if ( ! empty( $args['accepted'] ) && 'all' !== $args['accepted'] ) { 436 436 if ( $args['accepted'] == 'pending' ) { … … 441 441 } 442 442 443 // search_terms 443 // search_terms. 444 444 if ( ! empty( $args['search_terms'] ) ) { 445 445 $search_terms_like = '%' . bp_esc_like( $args['search_terms'] ) . '%'; … … 447 447 } 448 448 449 // Custom WHERE 449 // Custom WHERE. 450 450 if ( ! empty( $where_conditions ) ) { 451 451 $where = 'WHERE ' . implode( ' AND ', $where_conditions ); … … 468 468 protected static function get_order_by_sql( $args = array() ) { 469 469 470 // Setup local variable 470 // Setup local variable. 471 471 $conditions = array(); 472 472 $retval = ''; 473 473 474 // Order by 474 // Order by. 475 475 if ( ! empty( $args['order_by'] ) ) { 476 476 $order_by = implode( ', ', (array) $args['order_by'] ); … … 478 478 } 479 479 480 // Sort order direction 480 // Sort order direction. 481 481 if ( ! empty( $args['sort_order'] ) ) { 482 482 $sort_order = bp_esc_sql_order( $args['sort_order'] ); … … 484 484 } 485 485 486 // Custom ORDER BY 486 // Custom ORDER BY. 487 487 if ( ! empty( $conditions ) ) { 488 488 $retval = 'ORDER BY ' . implode( ' ', $conditions ); … … 505 505 global $wpdb; 506 506 507 // Setup local variable 507 // Setup local variable. 508 508 $retval = ''; 509 509 510 // Custom LIMIT 510 // Custom LIMIT. 511 511 if ( ! empty( $args['page'] ) && ! empty( $args['per_page'] ) ) { 512 512 $page = absint( $args['page'] ); … … 565 565 ); 566 566 567 // id 567 // id. 568 568 if ( ! empty( $args['id'] ) ) { 569 569 $where_clauses['data']['id'] = absint( $args['id'] ); … … 571 571 } 572 572 573 // user_id 573 // user_id. 574 574 if ( ! empty( $args['user_id'] ) ) { 575 575 $where_clauses['data']['user_id'] = absint( $args['user_id'] ); … … 577 577 } 578 578 579 // inviter_id 579 // inviter_id. 580 580 if ( ! empty( $args['inviter_id'] ) ) { 581 581 $where_clauses['data']['inviter_id'] = absint( $args['inviter_id'] ); … … 583 583 } 584 584 585 // invitee_email 585 // invitee_email. 586 586 if ( ! empty( $args['invitee_email'] ) ) { 587 587 $where_clauses['data']['invitee_email'] = $args['invitee_email']; … … 589 589 } 590 590 591 // class 591 // class. 592 592 if ( ! empty( $args['class'] ) ) { 593 593 $where_clauses['data']['class'] = $args['class']; … … 595 595 } 596 596 597 // item_id 597 // item_id. 598 598 if ( ! empty( $args['item_id'] ) ) { 599 599 $where_clauses['data']['item_id'] = absint( $args['item_id'] ); … … 601 601 } 602 602 603 // secondary_item_id 603 // secondary_item_id. 604 604 if ( ! empty( $args['secondary_item_id'] ) ) { 605 605 $where_clauses['data']['secondary_item_id'] = absint( $args['secondary_item_id'] ); … … 607 607 } 608 608 609 // type 609 // type. 610 610 if ( ! empty( $args['type'] ) && 'all' !== $args['type'] ) { 611 611 if ( 'invite' == $args['type'] || 'request' == $args['type'] ) { … … 630 630 } 631 631 632 // accepted 632 // accepted. 633 633 if ( ! empty( $args['accepted'] ) && 'all' !== $args['accepted'] ) { 634 634 if ( $args['accepted'] == 'pending' ) { … … 700 700 * } 701 701 * 702 * @return array BP_Invitation objects | IDs of found invit .702 * @return array BP_Invitation objects | IDs of found invite. 703 703 */ 704 704 public static function get( $args = array() ) { … … 706 706 $invites_table_name = BP_Invitation_Manager::get_table_name(); 707 707 708 // Parse the arguments 708 // Parse the arguments. 709 709 $r = bp_parse_args( $args, array( 710 710 'id' => false, … … 745 745 } 746 746 747 // WHERE 747 // WHERE. 748 748 $sql['where'] = self::get_where_sql( array( 749 749 'id' => $r['id'], … … 760 760 ) ); 761 761 762 // ORDER BY 762 // ORDER BY. 763 763 $sql['orderby'] = self::get_order_by_sql( array( 764 764 'order_by' => $r['order_by'], … … 766 766 ) ); 767 767 768 // LIMIT %d, %d 768 // LIMIT %d, %d. 769 769 $sql['pagination'] = self::get_paged_sql( array( 770 770 'page' => $r['page'], … … 977 977 } 978 978 979 // Values to be updated 979 // Values to be updated. 980 980 $update_args = array( 981 981 'invite_sent' => 'sent', 982 982 ); 983 983 984 // WHERE clauses 984 // WHERE clauses. 985 985 $where_args = array( 986 986 'id' => $id, … … 1000 1000 public static function mark_sent_by_data( $args ) { 1001 1001 1002 // Values to be updated 1002 // Values to be updated. 1003 1003 $update_args = array( 1004 1004 'invite_sent' => 'sent', … … 1023 1023 } 1024 1024 1025 // Values to be updated 1025 // Values to be updated. 1026 1026 $update_args = array( 1027 1027 'accepted' => 'accepted', 1028 1028 ); 1029 1029 1030 // WHERE clauses 1030 // WHERE clauses. 1031 1031 $where_args = array( 1032 1032 'id' => $id, … … 1046 1046 public static function mark_accepted_by_data( $args ) { 1047 1047 1048 // Values to be updated 1048 // Values to be updated. 1049 1049 $update_args = array( 1050 1050 'accepted' => 'accepted',
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)