Changeset 12915
- Timestamp:
- 04/28/2021 11:49:50 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-invitation-manager.php
r12914 r12915 389 389 390 390 /** 391 * Get a count of the number of invitations that match provided filter parameters. 392 * 393 * @since 8.0.0 394 * 395 * @see BP_Invitation::get_total_count() for a description of accepted parameters. 396 * 397 * @return int Total number of invitations. 398 */ 399 public function get_invitations_total_count( $args = array() ) { 400 // Default to returning invitations, not requests. 401 if ( empty( $args['type'] ) ) { 402 $args['type'] = 'invite'; 403 } 404 // Use the class_name property value. 405 $args['class'] = $this->class_name; 406 407 return BP_Invitation::get_total_count( $args ); 408 } 409 410 /** 391 411 * Get requests, based on provided filter parameters. 392 412 * … … 480 500 481 501 $r = bp_parse_args( $args, array( 502 'id' => false, 482 503 'user_id' => 0, 483 504 'invitee_email' => '', … … 489 510 $r['class'] = $this->class_name; 490 511 491 if ( ! ( ( $r['user_id'] || $r['invitee_email'] ) && $r['class'] && $r['item_id'] ) ) {512 if ( ! $r['id'] && ! ( ( $r['user_id'] || $r['invitee_email'] ) && $r['class'] && $r['item_id'] ) ) { 492 513 return false; 493 514 } … … 709 730 710 731 /** 732 * Delete an invitation by id. 733 * 734 * @since 8.0.0 735 * 736 * @param int $id ID of the invitation to delete. 737 * @return int|bool Number of rows deleted on success, false on failure. 738 */ 739 public function delete_by_id( $id ) { 740 // Ensure that the invitation exists and was created by this class. 741 $invite = new BP_Invitation( $id ); 742 if ( ! $invite->id || sanitize_key( $this->class_name ) !== $invite->class ) { 743 return false; 744 } 745 746 return BP_Invitation::delete_by_id( $id ); 747 } 748 749 /** 711 750 * This is where custom actions are added (in child classes) 712 751 * to determine whether an invitation should be allowed.
Note: See TracChangeset
for help on using the changeset viewer.