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
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.