Showing Discourse notifications in WordPress?

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.

Thanks if anyone can clarify.

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.

1 Like

OK cool. Maybe we’ll play with it and see if we can get this working as a part of our decision to use discourse or not. Thanks for the response!

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.

5 Likes

@HAWK that would be great if you don’t mind - I’m also looking into a similar setup as @lkramer

Sure, I’ll see what I can find out. Might take a couple of days as they’re offshore.

3 Likes

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.

6 Likes

I’d be very interested as well. Thanks for offering to share this solution.

@HAWK any update on how you guys did this?

Hey there,
See @riking’s post above. :slight_smile:

2 Likes