Hello! We’re considering the advised setup of WordPress installed on domain.com and discourse installed on community.domain.com and then using the WordPress plugin provided by Discourse for single sign on etc.
Obviously if someone is on community.domain.com they have a “notification” (like someone replied to a thread or what have you) the user will see that notification at the top of the screen.
But what about getting that notification to show up in WordPress? Is this functionality possible? Is it built in to the WordPress plugin already?
We envision our users will spend time on the main domain domain.com reading articles and so forth and we would like them to see any notifications they come up for forum threads they are involved in etc.
It’s a good idea, this has come up before – how do we surface Discourse notifications in the “parent” site – but we’ve never had a big customer seriously interested in pushing it forward, so we haven’t had the resources to work on it.
I do think this would be possible through the existing Discourse API; you could use the API call to poll for notifications for the currently logged in user, and then show them however you like on the parent website.
Pretty sure I’ve seen this in action over at FeverBee, am I right about that @HAWK? If so, maybe you could shed some light on how you’ve got this set up on your end?
Correct, we do have this implemented. I don’t know how it was done because I outsourced it, but my developers took advice from @riking so he might be the best person to answer this.
If not, I’m happy to send them an email and find out what was involved.
You need to set the cors origins site setting, and turn on DISCOURSE_ENABLE_CORS if you’re self-hosted. After that, it should be easy to request /notifications.json?silent=1.