Changeset 12450 for trunk/src/bp-members/bp-members-functions.php
- Timestamp:
- 08/24/2019 02:53:10 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-functions.php
r12393 r12450 611 611 612 612 /** 613 * Update the spam status of the member on multisite configs. 614 * 615 * @since 5.0.0 616 * 617 * @param int $user_id The user ID to spam or ham. 618 * @param int $value 0 to mark the user as `ham`, 1 to mark as `spam`. 619 * @return bool True if the spam status of the member changed. 620 * False otherwise. 621 */ 622 function bp_core_update_member_status( $user_id = 0, $value = 0 ) { 623 if ( ! is_multisite() || ! $user_id ) { 624 return false; 625 } 626 627 /** 628 * The `update_user_status()` function is deprecated since WordPress 5.3.0. 629 * Continue to use it if WordPress current major version is lower than 5.3. 630 */ 631 if ( bp_get_major_wp_version() < 5.3 ) { 632 return update_user_status( $user_id, 'spam', $value ); 633 } 634 635 // Otherwise use the replacement function. 636 $user = wp_update_user( array( 637 'ID' => $user_id, 638 'spam' => $value, 639 ) ); 640 641 if ( is_wp_error( $user ) ) { 642 return false; 643 } 644 645 return true; 646 } 647 648 /** 613 649 * Process a spammed or unspammed user. 614 650 * … … 672 708 673 709 // Finally, mark this user as a spammer. 674 if ( is_multisite() ) { 675 update_user_status( $user_id, 'spam', $is_spam ); 676 } 710 bp_core_update_member_status( $user_id, $is_spam ); 677 711 } 678 712
Note: See TracChangeset
for help on using the changeset viewer.