Change WordPress user roles and capabilities › Forums › Give user access to plugin – how to › Multiple roles help › Reply To: Multiple roles help
13/03/2016 at 16:18
#2124
Vladimir
Keymaster
Hi,
1st, correct the typo, you should have ‘Complete’ instead of ‘Complet’ in the 2nd login expression.
2nd, role shown by WordPress as a ‘primary’ role should be the 1st in the roles array (have index 0). So remove all roles from the user, then add ‘instructor’ role. It will become a primary this way. Then add ‘participant’ role back as a secondary role.
$user->set_role('instructor');
$user->add_role('participant');