• Resolved alexsteninge

    (@alexsteninge)


    Hi,
    I have added some additional custom roles to a bbpress installation in WordPress. I can add the custom roles as forum roles in the user, but I cannot find them in your plugin. I use the bbp_get_dynamic_roles filter.

    What list do look into in order to populate the “Choose which roles can see this content”?

    I can only see that one other person has had a similar issue (very recent), so I have not been able to find something to tell me this. Maybe my searching skills are to bad 🙂

    Btw – would it be possible for me to make a translation into DA to you guys with a .po file instead of the online setup?

    Br Alex

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    @alexsteninge – Sorry for the delay.

    So bbpress does not register those roles within WordPress. They are non-existent in WordPress’s perspective. They are essentially a bolt on way to add additional roles.

    I’m not sure there is a quick solution as you would need to overwrite our role testing code to account for bbPress being active and then use their helper functions to check those “roles”.

    We can look into whether a filter in our code could make that more efficient as well.

    Submit an issue on our github and we can follow up there.

    https://github.com/JunglePlugins/Content-Control

    Hope that helps.

    Thread Starter alexsteninge

    (@alexsteninge)

    There must be a place in your plugin where you get the list of role names the bbpress… Somewhere… No matter if they are “real” roles as seen by WP or not. It does not really matter from where it is fetched. I am sure that you have not hardcoded the role names in your plugin. What e.g. if bbpress chose to rename some of the role names?

    I don’t mind coding – and I get if the plugin is updated, I will (probably) need to add the code again – but could you tell me where, so I don’t have to look your entire code through?

    Plugin Author Daniel Iser

    (@danieliser)

    @alexsteninge – Sorry didn’t see a notification.

    That said there are multiple parts, you seem to only be considering one:

    1. You need a list of roles to show in the editor so you can choose them, as you guessed we dynamically get this list from WP, so its fresh even if you add roles: https://github.com/JunglePlugins/Content-Control/blob/master/classes/Roles.php#L23

    2. You also need to write custom code to check for those roles. As you can see in this code here we check what WP roles the user has when logged in, we get them directly from WP and check if they match what you chose from #1 above.

    Now again bbPress does not register roles with WordPress, so they won’t automatically/dyncamically populate into these sections as is. It requires calling bbPress functions in #1 to get and merge an additional list of roles specific to their plugin, as well as calling another of their functions in #2 above to to get a list of their bbPress roles and check those against the ones chosen.

    If you use the filters in the 2 sections of code above and put the code in a custom plugin or child-theme you can rest assured it won’t get erased when you update our plugin.

    I have added it to our issue tracker for future update: https://github.com/JunglePlugins/Content-Control/issues/25

    If you get stuck post on the github issue above and several of our team will see it.

    Hope that helps.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom roles’ is closed to new replies.