Change WordPress user roles and capabilities › Forums › Bug Reports › Not being assigned forum role upon subscription
- This topic has 3 replies, 2 voices, and was last updated 5 years ago by Vladimir.
-
AuthorPosts
-
20/12/2019 at 03:15 #6192demonboyParticipant
Hi,
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?
Thanks
23/12/2019 at 04:47 #6193VladimirKeymasterHi,
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.
23/12/2019 at 06:33 #6194demonboyParticipantHi 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?
23/12/2019 at 12:17 #6195VladimirKeymasterI 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:bbpress/includes/core/options.php:535: return apply_filters( 'bbp_get_default_role', get_option( '_bbp_default_role', $default ) );
-
AuthorPosts
- You must be logged in to reply to this topic.