Change user role after bulk-import

From your question, I’m assuming these are users on a specific blog within a MultiSite installation, correct? In that case, do the following:

  1. Go to the blog for which you want to make these users administrators.
  2. Click on the “Users” button in the left-side admin sidebar
    • This will present you with a display of about 20 users at a time (the display is paged)
  3. Click the checkbox next to the users you wish to promote
  4. At the top of the list is a dropdown box that says “Change role to…” – Select “Administrator” from this select box
  5. Click the “Change” button to the right of the select box

You’ll have to do this for each page of users, and with 4000 users you’ll have about 160 pages of results. But it’s doable.


Update

If you want some specific code, I recommend looking at the WP_User class. This class defines two methods that you’d need to use iteratively: for_blog() and add_role().

Basically, you’ll need to loop through your users based either on their IDs or usernames. Consider this untested example code:

$ids = [1,2,3,4];
foreach($ids as $id) {
    $user = new WP_User($id);
    $user->for_blog( ... user's blog id ... );
    $user->remove_role('subscriber');
    $user->add_role('administrator');
}

By default, the add_role() method of the WP_User class will act on the current blog … you use for_blog() to switch to a specific blog before running the add_role() method.

So if you have the ids of your users and the ids of the blogs they’re supposed to be administrators for, you can loop through them pretty easily and set them up as administrators for their specific sites.