Description
Update the status of a user in the database. Used in core to mark a user as spam or "ham" (not spam) on multisite installs.
Usage
<?php update_user_status( $id, $pref, $value ); ?>
Parameters
- $id
- (integer) (required) The ID of the user.
- Default: None
- $pref
- (string) (required) The column in the wp_users table to update the user's status in (presumably user_status, spam or deleted).
- Default: None
- $value
- (integer) (required) The new status for the user.
- Default: None
- $deprecated
- (null) (optional) This parameter is deprecated and should not be used.
- Default: null
Returns Values
- (integer)
- Returns the $value parameter.
Examples
Mark a User as Spam
Note: You can only do this on multisite installs!
$user_id = 394;
update_user_status( $user_id, 'spam', 1 );
Mark a User as Ham
$user_id = 394;
update_user_status( $user_id, 'spam', 0 );
Again, this will not work on single site installs.
Notes
Change Log
- 3.0.2: The $refresh parameter was deprecated.
- Since: 3.0.0
Source File
update_user_status() is located in wp-admin/includes/ms.php
.
Related