Discourse as SSO host -> Restrict content in WP based on Discourse groups

I have a premium group in my forum which I want to provide access to exclusive content in wordpress.
Is there any way to restrict certain wordpress pages or content based on Discourse user roles or groups?

Using wordpress as SSO host is not an option unfortunately

Is there any way to set up a custom shortcode which makes an API call to check the user’s group status?

In it’s current form, No but maybe it would come in near future … @simon any Plans on such implementation?

Are you using the WP Discourse plugin? If so, some functions have been added to the latest version (1.5.0) that could help you. It will be in the WordPress plugin repository later today.

The functions were added with the opposite use case in mind - restricting content on Discourse based on membership in a WordPress group, but they could be used to do what you want. I’ll write some documentation about how to use the functions later this week.

4 Likes

Perfect timing! Will test it then …

I need to make a small change to the get_discourse_user function that has been added. It’s currently not returning the groups data. I can add a parameter to it so that it returns all the data that is available for the user. That will be in the next update - sometime later this week.

2 Likes