A bug in the WP Discourse plugin was reported by mpemburn after updating to WordPress 5.5. The issue occurs in the initialize_update_user_route method of the SyncDiscourseUser class, requiring a permission_callback. mpemburn suggested adding 'permission_callback' => '__return_true' as a fix. fzngagan and pfaffman confirmed this is the correct place to report the issue and suggested submitting a pull request to GitHub. simon apologized for the delayed response, confirmed the suggested fix, and updated the plugin to version 2.1.4 with an explicit permission callback for the update-user REST route.
I found a bug in the WP plugin and reported it a couple of days ago, including how to fix it. Haven’t heard a peep so far, and it’s causing us some problems. Does anyone here work on this project, or know someone who does?
Here’s the issue:
This seems to have only become a problem since we updated to WordPress 5.5. The actual problem occurs in the initialize_update_user_route method of the SyncDiscourseUser class. Apparently register_rest_route now requires that you have a permission_callback . I added 'permission_callback' => '__return_true' after line 53, and the problem went away. We are using WP Discourse version 2.1.2
Sorry about the delayed reply to this. Your suggested fix will work.
The webhook request is being validated in the call to verify_discourse_webhook_request, but there isn’t an explicit permission_callback on the route - it sounds like that fails in WordPress 5.5. I had thought it would just give a deprecation warning.
I’ll update the plugin with your suggested fix for now. Later we can look into calling the verify_discourse_webhook_request from the route’s permission callback instead of from the its callback.
Edit: WP Discourse version 2.1.4 adds an explicit permission callback to the update-user REST route. It’s in the WordPress repo now.