Reply To: Add Custom User Roles
Hope I’m grasping that correctly.
nearly
I scrapped part 2, then
what I actually did was take the final three roles form your original part 1 (I moved the participant one down to make it consistent)
so if you look at the councilman role
Then where you had
$bbp_roles['my_custom_role6'] = array(
'name' => 'Councilman',
'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as keymaster
);
This will set a role called my-custom-role-6 to the name and capabilities, and if that role doesn’t exist will create it. WordPress generally doesn’t worry about whether something already exists, if it does it overwrites it, and if it doesn’t it creates it.
Now I could have simply changed ‘my_custom_roles_6 to bbp_keymaster, and it would have changed the existing role bbp_keymaster name and capabilities to what was in that line
But for reasons I won’t bore you with, it is better to call a function which gets that role
hence the new line before
$keymaster = bbp_get_keymaster_role() ;
Then you just use that $keymaster variable set in the line before