[Solved]
If anybody hasthe same problem, I solved it by creating a small plugin out of the code so it’ll load on time.
<?php
/*
Plugin Name: FilterBbRoleMap
*/
if(!class_exists('FilterBbRoleMap')) {
	class FilterBbRoleMap
	{
		public function __construct()
		{
			add_filter('bbp_get_user_role_map', 'add_spectator_role');
			function add_spectator_role($role_map) {
				$role_map['prefix_spectator'] = bbp_get_spectator_role();
				return $role_map;
			}
		}
	}
	$FilterBbRoleMap = new FilterBbRoleMap();
}