update_user_status()
Deprecated since 5.3.0. It is no longer supported and may be removed in future releases. Use wp_update_user() instead.
Updates the user status in the database. For multisites.
Used in the core, in multisite mode, to place the user in spam: sets the label spam or ham.
Hooks from the function
Returns
Int. The value passed in $value.
Usage
update_user_status( $id, $pref, $value, $deprecated );
- $id(integer) (required)
- User ID.
- $pref(string) (required)
- Column in the wp_users table to update the user status (presumably user_status, spam, or deleted).
- $value(integer) (required)
- New user status.
- $deprecated(null)
- Deprecated since version 3.0.2.
Default: null
Examples
#1 Move a user to spam
Works only for multisites.
$user_id = 394; update_user_status( $user_id, 'spam', 1 );
#2 Mark a User as "Ham"
This will not work on single site installs.
$user_id = 394; update_user_status( $user_id, 'spam', 0 );
Notes
- See: wp_update_user()
- Global. wpdb. $wpdb WordPress database abstraction object.
Changelog
| Since 3.0.0 | Introduced. |
| Deprecated since 5.3.0 | Use wp_update_user() |