if ( !
is_multisite() ) { update_user_meta( $user_id, 'show_welcome_panel', 1
);
} elseif ( !
is_super_admin( $user_id ) && !
metadata_exists( 'user',
$user_id, 'show_welcome_panel'
) ) { update_user_meta( $user_id, 'show_welcome_panel', 2
);
} if ( is_multisite() ) { // Flush rules to pick up the new page.
$wp_rewrite->
init();
$wp_rewrite->
flush_rules();
$user =
new WP_User( $user_id );
$wpdb->
update( $wpdb->options, array
( 'option_value' =>
$user->user_email
), array
( 'option_name' => 'admin_email'
) );
// Remove all perms except for the login user.
$wpdb->
query( $wpdb->
prepare( "DELETE FROM
$wpdb->usermeta WHERE user_id != %d AND meta_key = %s",
$user_id,
$table_prefix . 'user_level'
) );
$wpdb->
query( $wpdb->
prepare( "DELETE FROM
$wpdb->usermeta WHERE user_id != %d AND meta_key = %s",
$user_id,
$table_prefix . 'capabilities'
) );
/*
* Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.)
* TODO: Get previous_blog_id.
*/