Forum Replies Created

Viewing 1 replies (of 1 total)
  • I just ran into this myself and found the same thing for user_status. wp_update_user() won’t change user_status.

    From other threads I see that user_status is effectively a “dead” field. It remains in the wp_user table, but isn’t used by WP itself for anything anymore. Probably explains why wp_update_user doesn’t touch it.

    Regardless, my solution was just using wpdb to write a direct SQL call to update the user_status field:

    global $wpdb;
    $wpdb->query('UPDATE wp_users SET user_status = 1 WHERE ID = '.$current_user->ID);

    Note that I’m setting an explicit internal value here via code. If you’re setting values based on user input, don’t use a literal SQL string as I’ve done above. Instead use one of the many secure SQL-generating functions detailed on this page:

    https://codex.www.ads-software.com/Class_Reference/wpdb

Viewing 1 replies (of 1 total)