WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/update user status

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

Source File

update_user_status() is located in wp-admin/includes/ms.php.

Related

See also index of Function Reference and index of Template Tags.
This article is marked as in need of editing. You can help Codex by editing it.