I have set up custom forum roles based on the ‘participant’ role. When a new user subscribes to my site they are assigned one of these custom roles. However they appear as a site role, not a forum role, and every new subscriber is assigned the ‘spectator’ role instead.
How do I ensure they are assigned the correct forum role upon subscription?
bbPress uses as a forum roles only its own built-in roles: bbp_participant, bbp_spectator, etc. bbPress processes them separately from other existing roles. Thus any other role with bbPress user capabilities is shown as a custom role, not a forum role.
It does not matter, as finally, user permissions are defined as a simple sum of user capabilities included into all roles granted to this user.
Hi Vladimir, thanks for getting back to me. What I am not understanding is that I have set these custom roles within my functions.php file like so:
$bbp_roles['bosun'] = array(
'name' => 'Bosun',
'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants
And also within URE, emulating the participant role.
Moreover these custom forum roles are appearing as options in the Forum Role drop-down list within a user’s profile edit page. Also when viewing all users within WP, there is a Forum Role column, which displays my custom forum roles for each user.
Are you saying that despite creating these custom forum roles, bbpress will never see them as official forum roles and only assigns them ‘participant’, ‘spectator’ etc automatically?
I wrote answer in assumption that you create custom role with URE.
bbPress creates its roles on the fly, via code. So if you use some of bbPress filters to add your own role, it may be correct. If you use right filter, bbPress should show your role at its own roles drop-down lists. Try Settings->Forums->Roles to set bbPress your own default role for new registered users.
Or try to redefine bbPress default role using its ‘bbp_get_default_role’ filter: