The discussion revolves around determining a Discourse user’s approval status in WordPress to dynamically route users to either an application form or the Discourse community. Himanshu_Singh seeks a way to check if a user is approved in Discourse without relying on slow API calls. angus explains that the WP-Discourse plugin does not store approval status but suggests using the wpdc_after_sync_sso action to capture the approval status directly during sync. Himanshu_Singh shares his implementation using the Discourse Data Explorer API and template_redirect to update a custom field in WordPress, avoiding repeated API calls once the status is stored.
I want to create a user automatically in Discourse when new registration happens in WordPress but I don’t want to give them access before they complete an application form.
I am able to use sync on login and must approve users settings to achieve most of this but I don’t know how to retrieve if the user is approved in Discourse?
Is there a WP user meta field that Discourse uses to store Discourse user approved status? If not, do I need to use an API to get the information from Discourse?
My goal - I want to show a button on my dashboard in WP with a dynamic link that changes based on approved or unapproved status.
Unapproved user - dynamic link directs to application form on WP
Approved user - dynamic link directs to the discourse community.
I looked at a few posts but could not find a solution. Help appreciated!
I figured out how to make this happen by writing a data explorer query and calling it via API. It works fine but now I am making a call between two systems which is obviously slower than having the data saved in WP.
If the page load is slow, I would use a hook to store the approval data in user custom field on my own. Before I go ahead, it would be good to know if WP-Discourse Plugin already does that.