Changeset 7029 for trunk/src/includes/users/capabilities.php
- Timestamp:
- 12/13/2019 07:30:18 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/users/capabilities.php
r7006 r7029 485 485 } 486 486 487 // Makearray of post types to mark as spam487 // Get array of post types to mark as spam 488 488 $post_types = array( bbp_get_topic_post_type(), bbp_get_reply_post_type() ); 489 489 $post_types = "'" . implode( "', '", $post_types ) . "'"; 490 490 491 // Get array of statuses to mark as spam 492 $post_statuses = bbp_get_public_topic_statuses(); 493 $post_statuses = "'" . implode( "', '", $post_statuses ) . "'"; 494 491 495 // Loop through blogs and remove their posts 492 496 foreach ( (array) array_keys( $blogs ) as $blog_id ) { … … 496 500 497 501 // Get topics and replies 498 $query = $bbp_db->prepare( "SELECT ID FROM {$bbp_db->posts} WHERE post_author = %d AND post_status = %s AND post_type IN ( {$post_types} )", $user_id, bbp_get_public_status_id());502 $query = $bbp_db->prepare( "SELECT ID FROM {$bbp_db->posts} WHERE post_author = %d AND post_status IN ( {$post_statuses} ) AND post_type IN ( {$post_types} )", $user_id ); 499 503 $posts = $bbp_db->get_col( $query ); 500 504 … … 522 526 } 523 527 528 // Delete user options 529 bbp_delete_user_options( $user_id ); 530 524 531 // Success 525 532 return true; … … 563 570 } 564 571 565 // Makearray of post types to mark as spam572 // Get array of post types to mark as spam 566 573 $post_types = array( bbp_get_topic_post_type(), bbp_get_reply_post_type() ); 567 574 $post_types = "'" . implode( "', '", $post_types ) . "'"; 568 575 576 // Get array of statuses to unmark as spam 577 $post_statuses = array( bbp_get_spam_status_id() ); 578 $post_statuses = "'" . implode( "', '", $post_statuses ) . "'"; 579 569 580 // Loop through blogs and remove their posts 570 581 foreach ( (array) array_keys( $blogs ) as $blog_id ) { … … 574 585 575 586 // Get topics and replies 576 $query = $bbp_db->prepare( "SELECT ID FROM {$bbp_db->posts} WHERE post_author = %d AND post_status = %s AND post_type IN ( {$post_types} )", $user_id, bbp_get_spam_status_id());587 $query = $bbp_db->prepare( "SELECT ID FROM {$bbp_db->posts} WHERE post_author = %d AND post_status IN ( {$post_statuses} ) AND post_type IN ( {$post_types} )", $user_id ); 577 588 $posts = $bbp_db->get_col( $query ); 578 589 … … 600 611 } 601 612 613 // Update topic & reply counts 614 bbp_update_user_topic_count( $user_id, bbp_get_user_topic_count_raw( $user_id ) ); 615 bbp_update_user_reply_count( $user_id, bbp_get_user_reply_count_raw( $user_id ) ); 616 617 // Update last posted (to now) 618 bbp_update_user_last_posted( $user_id ); 619 602 620 // Success 603 621 return true;
Note: See TracChangeset
for help on using the changeset viewer.