if ( ( $bb_current_id == $user->ID && $can_keep_gate ) || ( array_key_exists(‘keymaster’, $user->capabilities) && !$can_keep_gate ) )
$roles = array( ‘keymaster’ => $roles );
elseif ( !$can_keep_gate ) // only keymasters can promote others to keymaster status
By the way–I don’t know if it matters, but everything does work now. I set all users to members and everything is functioning correctly.