Open WP as a subdomain of Discourse (different hostings, only DNS pointing)

I couldn’t find answer for my scheme here. Can you help with my task?

I think that this info may be userful for those members who are not familiar with programmings, hosting moments and used to have file manager, MySQL and phpMyAdmin to serve Wordpress websites.
I found that it’s better to have a separate hosting for Wordpress with it’s own domain and a special dedicated hosting for a Discourse instance.

What I have:
Discourse (hosting1, domain1) + Wordpress (hosting2, domain2).

  1. Discourse is a main site, that is promoted. Now it’s on digitalocean server1, within a domain1.
  2. Wordpress will be used only as a membership platform and payments gateway.
    WP is installed on the server2 with another hosting provider. Now it has its’ own domain2.

I want:

  1. open Wordpress site as a subdomain of Discourse domain (wordpress.discourse.site), but host WP and Discourse separatly as it is now.
  2. give user ability to login once in Discourse and stay loged in Wordpress instantly) - I think that it is another way to “make wordpress sso provider for discourse” or I’m mistaken here?

The logic is following:

  1. User visits main Discourse site. Signup at Discourse site (Important), because Discourse is a main entrance.
  2. When the user wants to pay for a membership the user goes to the subdomain Wordpress.Discourse.site. this site is used ONLY to serve memberships.
  3. The user doesn’t need to login Wordpress, because he is logged in Discourse already.
  4. User pays and WP membership plugin adds him to a specific group, granting necessary access.
  5. User is redirected to the main Discourse.site.

Please, give me your thoughts on
what is possible and what is not,
how can I do this DNS redirect,
may be your ideas.

Install the wp-discourse plugin and set up sso. There are topics about hour to configure various membership plugins.

3 Likes

Can this sso work backwards to wordpress? E.x. user logs in Discourse and get access to wordpress?

1 Like

This is possible. Have a look at the “WordPress as the SSO Client” section of Install and configure the WP Discourse Wordpress plugin for Discourse.

The plugin can be configured to handle everything up until your 4th point. The WP Discourse plugin doesn’t know anything about the membership plugin that you have installed on your WordPress site, so any integration between that plugin and Discourse will have to be developed by you. It should be possible to do this, but the most common use of the WP Discourse plugin with memberships is to have WordPress as the SSO provider for Discourse, so there are not any code examples that I know of that are doing things in the way you are proposing. I think it would be a good use of the plugin though.

3 Likes