User Roles in multisite – odd behavior

Nikolay

Can’t comment on my own question, so I guess that giving a loose answer is the best and only way to get back to you.

How I’m getting the roles:

$user = get_user_by('login', 'newuser');
$user_meta = get_userdata($user->ID);
$user_roles = $user_meta->roles;
  • I do not use any plugin. Fresh WP multisite.

I also tried a small trick to get over this:

if(empty($user_roles)) {
    $wp_user_object = new WP_User($user->ID);
    $wp_user_object->add_role('editor');
}

But the roles arrays is still empty and I’m not able to login in the subsite with the moved user.

What makes this interesting is that in the subsite’s dashboard you can see that the user is an “Editor”

EDIT:
can’t comment on my own question because this account is used in different stackexchange forum, and I posted this question as an guest. duh