bp_core_admin_user_manage_spammers()
Catch requests to mark individual users as spam/ham from users.php.
Description
Source
File: bp-core/admin/bp-core-admin-functions.php
1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 | function bp_core_admin_user_manage_spammers() { // Print our inline scripts on non-Multisite. add_action( 'admin_footer' , 'bp_core_admin_user_spammed_js' ); $action = isset( $_REQUEST [ 'action' ] ) ? $_REQUEST [ 'action' ] : false; $updated = isset( $_REQUEST [ 'updated' ] ) ? $_REQUEST [ 'updated' ] : false; $mode = isset( $_POST [ 'mode' ] ) ? $_POST [ 'mode' ] : false; // If this is a multisite, bulk request, stop now! if ( 'list' == $mode ) { return ; } // Process a spam/ham request. if ( ! empty ( $action ) && in_array( $action , array ( 'spam' , 'ham' ) ) ) { check_admin_referer( 'bp-spam-user' ); $user_id = ! empty ( $_REQUEST [ 'user' ] ) ? intval ( $_REQUEST [ 'user' ] ) : false; if ( empty ( $user_id ) ) { return ; } $redirect = wp_get_referer(); $status = ( $action == 'spam' ) ? 'spam' : 'ham' ; // Process the user. bp_core_process_spammer_status( $user_id , $status ); $redirect = add_query_arg( array ( 'updated' => 'marked-' . $status ), $redirect ); wp_redirect( $redirect ); } // Display feedback. if ( ! empty ( $updated ) && in_array( $updated , array ( 'marked-spam' , 'marked-ham' ) ) ) { if ( 'marked-spam' === $updated ) { $notice = __( 'User marked as spammer. Spam users are visible only to site admins.' , 'buddyboss' ); } else { $notice = __( 'User removed from spam.' , 'buddyboss' ); } bp_core_add_admin_notice( $notice ); } } |
Changelog
Version | Description |
---|---|
BuddyPress 2.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.