We’re in the midst of changing forums from BBPress to Discourse. We have a Membership based website on WordPress using WooMembership with 2 levels of member access (they all get the forums), except if they cancel their subscription/membership.
I want to know if its possible with the current WP Discourse plugin to ensure that ONLY paying members are allowed to enter the forum?
Yes, if you use your WordPress site as the SSO provider for your forum, there is an action hook that you can use to limit which users are able to login to the forum. The hook is called wpdc_sso_provider_before_sso_redirect. Some code like this, added to a plugin or your theme’s functions.php file will work. You will need to figure out how to check the user’s WooMembership level.
add_action( 'wpdc_sso_provider_before_sso_redirect', 'wpdc_custom_check_user_membership', 10, 2 );
function wpdc_custom_check_user_membership( $user_id, $user ) {
if ( /* Some condition that returns true if the user doesn't meet the membership requirement */ ) {
wp_safe_redirect( home_url() );
exit;
}
}
I can’t take on any private work, but I can give you some help through this forum. Most of what you are looking to do is provided by the WP Discourse plugin out of the box. By default, the WP Discourse plugin will give all users on your WordPress site access to your Discourse forum. To limit access to users who have purchased a membership, we just need to know how to fill in this part of the code that I posted above:
/* Some condition that returns true if the user doesn't meet the membership requirement */
Got it – thanks for your help – looks straight forward. I’m looking at the hosted Discourse, $100/mo - is that the plan that would be easiest to connect with the plugin and run the forum?
I just want to make sure that, they can only access the forum via going to the main website, and they can’t just access the forum without logging in via website or cancelled their membership.
Hi @JeremyC, I’m considering doing something similar. Would you be able to share your experiences with it? I’d love to talk about it to see if this is a good fit…
이 스레드가 오래된 것임을 알고 있습니다. 같은 플로우(사용자가 Woo Memberships를 통해 가입하고 Discourse 포럼에 접근하는 방식)를 통합하려고 합니다. 다만, 클라이언트가 WordPress를 SSO 제공자로 사용하기를 원하지 않습니다. 이런 경우에도 여전히 가능한가요?
사용자가 Woo Memberships를 통해 가입할 때 Discourse 사용자를 생성하고/또는 Discourse 그룹에 추가하는 방식입니다. 이는 Discourse API를 통해 수행할 수 있습니다. 단순히 포럼 초대장을 보내는 것보다 구현이 더 복잡할 수 있지만, 멤버십이 만료되면 사용자를 그룹에서 _제거_할 수도 있어야 할 가능성이 있으므로 이 접근 방식을 살펴볼 가치가 있을 수 있습니다.