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

**URL:** https://meta.discourse.org/t/discourse-as-sso-host-restrict-content-in-wp-based-on-discourse-groups/74509
**Category:** WordPress
**Created:** [November 21, 2017, 1:15pm UTC](https://meta.discourse.org/t/discourse-as-sso-host-restrict-content-in-wp-based-on-discourse-groups/74509 "2017-11-21T13:15:09Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![anon36484860](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@anon36484860](https://meta.discourse.org/u/anon36484860)
#### Post date: [November 21, 2017, 1:15pm UTC](https://meta.discourse.org/t/discourse-as-sso-host-restrict-content-in-wp-based-on-discourse-groups/74509/1 "2017-11-21T13:15:09Z")

</div>

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

---

<div class="post-metadata">

### Author: ![anon36484860](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@anon36484860](https://meta.discourse.org/u/anon36484860)
#### Post date: [November 21, 2017, 1:55pm UTC](https://meta.discourse.org/t/discourse-as-sso-host-restrict-content-in-wp-based-on-discourse-groups/74509/3 "2017-11-21T13:55:05Z")

</div>

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

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [November 21, 2017, 1:58pm UTC](https://meta.discourse.org/t/discourse-as-sso-host-restrict-content-in-wp-based-on-discourse-groups/74509/4 "2017-11-21T13:58:10Z")

</div>

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

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [November 21, 2017, 4:43pm UTC](https://meta.discourse.org/t/discourse-as-sso-host-restrict-content-in-wp-based-on-discourse-groups/74509/5 "2017-11-21T16:43:52Z")

</div>

> [@anon36484860](#):
>
> Is there any way to restrict certain wordpress pages or content based on Discourse user roles or groups?

Are you using the [WP Discourse](https://github.com/discourse/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.

---

<div class="post-metadata">

### Author: ![anon36484860](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@anon36484860](https://meta.discourse.org/u/anon36484860)
#### Post date: [November 21, 2017, 5:03pm UTC](https://meta.discourse.org/t/discourse-as-sso-host-restrict-content-in-wp-based-on-discourse-groups/74509/6 "2017-11-21T17:03:27Z")

</div>

Perfect timing! Will test it then …

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [November 21, 2017, 10:57pm UTC](https://meta.discourse.org/t/discourse-as-sso-host-restrict-content-in-wp-based-on-discourse-groups/74509/7 "2017-11-21T22:57:40Z")

</div>

> [@anon36484860](#):
>
> 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.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:43pm UTC](https://meta.discourse.org/t/discourse-as-sso-host-restrict-content-in-wp-based-on-discourse-groups/74509/8 "2024-06-08T12:43:52Z")

</div>

This topic was automatically closed after 2390 days. New replies are no longer allowed.
