New user activation link doesn't work when activating Discourse WP plugin

AI-generated summary

User rodrigo.braga reported that the new user activation link fails when the Discourse WP plugin is active, displaying an error message. The link includes an extra mail_key parameter when the plugin is enabled, which breaks activation. angus confirmed the issue is directly tied to the plugin’s activation and asked about logs and recent WordPress changes rodrigo.braga. After reproducing the bug, angus confirmed a fix is under review and will be included in version 2.5.1 of the plugin, linked to GitHub PR #499. rodrigo.braga verified the fix by testing the branch and confirmed it resolves the issue. The root cause appears to be a compatibility issue introduced in recent versions of either the plugin or WordPress, specifically around how the mail_key parameter is handled during activation.

I have a WordPress Site that is the SSO provider for Discourse using the WPDiscourse plugin.

I am not sure when it started happening but probably in the last couple of months, when a new user tries to register to the site they receive an activation link that looks like this without WP_Discourse plugin:

And works well, but when DiscourseWP is active the activation link looks like:

https://www.ic.org/wp-login.php?action=rp&key=WBY2TEgStZiyj0DmqdrO&mail_key=1706042380_QlvCHBt2HfsX3YAqByQJ&login=reg5

and I see the following message:

Any clues?

Hey @rodrigo.braga

Are you sure this the only difference between seeing the error and not seeing the error? i.e. when you deactivate the plugin the error goes away immediately and when you reactivate it it comes back?

Yes, the links I shared were received between two tests where the only difference was DiscourseWP being active or not.

I tried downgrading DiscourseWP but the same happens, I wonder if there is something in recent releases of WP that might have impact in the mail_key verification by discourse.

Is there anything relevant you can see in the WP Discourse logs?

(p.s. I am looking into this, just want to cover the bases)

@rodrigo.braga Thanks for reporting this. I was able to reproduce it. The fix is currently under review and will be in the next version of the plugin (2.5.1) which will be released very soon.

https://github.com/discourse/wp-discourse/pull/499

Thank you very much for the quick response, I downloaded the branch and confirm that it solves my issue.