Action hook 'make_spam_user'

in WP Core File wp-includes/ms-deprecated.php at line 726

View Source

make_spam_user

Action Hook
Description
Update the status of a user in the database. Previously used in core to mark a user as spam or "ham" (not spam) in Multisite.

Hook Information

File Location wp-includes/ms-deprecated.php View on GitHub
Hook Type Action
Line Number 726

Hook Parameters

Type Name Description
int $id The user ID.
string $pref The column in the wp_users table to update the user's status in (presumably user_status, spam, or deleted).
int $value The new status for the user.
null $deprecated Deprecated as of 3.0.2 and should not be used.

Usage Examples

Basic Usage
<?php
// Hook into make_spam_user
add_action('make_spam_user', 'my_custom_function', 10, 4);

function my_custom_function($id, $pref, $value, $deprecated) {
    // Your custom code here
}

Source Code Context

wp-includes/ms-deprecated.php:726 - How this hook is used in WordPress core
<?php
 721  	clean_user_cache( $user );
 722  
 723  	if ( 'spam' === $pref ) {
 724  		if ( $value == 1 ) {
 725  			/** This filter is documented in wp-includes/user.php */
 726  			do_action( 'make_spam_user', $id );
 727  		} else {
 728  			/** This filter is documented in wp-includes/user.php */
 729  			do_action( 'make_ham_user', $id );
 730  		}
 731  	}

PHP Documentation

<?php
/**
 * Update the status of a user in the database.
 *
 * Previously used in core to mark a user as spam or "ham" (not spam) in Multisite.
 *
 * @since 3.0.0
 * @deprecated 5.3.0 Use wp_update_user()
 * @see wp_update_user()
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int    $id         The user ID.
 * @param string $pref       The column in the wp_users table to update the user's status
 *                           in (presumably user_status, spam, or deleted).
 * @param int    $value      The new status for the user.
 * @param null   $deprecated Deprecated as of 3.0.2 and should not be used.
 * @return int   The initially passed $value.
 */
Quick Info
  • Hook Type: Action
  • Parameters: 4
  • File: wp-includes/ms-deprecated.php
Related Hooks

Related hooks will be displayed here in future updates.