bp_core_admin_user_manage_spammers

Catch requests to mark individual users as spam/ham from users.php.

Description

bp_core_admin_user_manage_spammers(); 

Usage

  1. if ( !function_exists( 'bp_core_admin_user_manage_spammers' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/admin/bp-core-admin-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_core_admin_user_manage_spammers(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-core/admin/bp-core-admin-functions.php  
  1. function bp_core_admin_user_manage_spammers() { 
  2.  
  3. // Print our inline scripts on non-Multisite. 
  4.  
  5. $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : false; 
  6. $updated = isset( $_REQUEST['updated'] ) ? $_REQUEST['updated'] : false; 
  7. $mode = isset( $_POST['mode'] ) ? $_POST['mode'] : false; 
  8.  
  9. // If this is a multisite, bulk request, stop now! 
  10. if ( 'list' == $mode ) { 
  11. return; 
  12.  
  13. // Process a spam/ham request. 
  14. if ( ! empty( $action ) && in_array( $action, array( 'spam', 'ham' ) ) ) { 
  15.  
  16. check_admin_referer( 'bp-spam-user' ); 
  17.  
  18. $user_id = ! empty( $_REQUEST['user'] ) ? intval( $_REQUEST['user'] ) : false; 
  19.  
  20. if ( empty( $user_id ) ) { 
  21. return; 
  22.  
  23. $redirect = wp_get_referer(); 
  24.  
  25. $status = ( $action == 'spam' ) ? 'spam' : 'ham'; 
  26.  
  27. // Process the user. 
  28. bp_core_process_spammer_status( $user_id, $status ); 
  29.  
  30. $redirect = add_query_arg( array( 'updated' => 'marked-' . $status ), $redirect ); 
  31.  
  32. wp_redirect( $redirect ); 
  33.  
  34. // Display feedback. 
  35. if ( ! empty( $updated ) && in_array( $updated, array( 'marked-spam', 'marked-ham' ) ) ) { 
  36.  
  37. if ( 'marked-spam' === $updated ) { 
  38. $notice = __( 'User marked as spammer. Spam users are visible only to site admins.', buddypress ); 
  39. } else { 
  40. $notice = __( 'User removed from spam.', buddypress ); 
  41.