WordPress / five-for-the-future

Plugins and themes for the Five for the Future subsite
https://wordpress.org/five-for-the-future/
44 stars 21 forks source link

[Bug] New Organization Pledge Email Confirmation Failure #244

Closed naokomc closed 7 months ago

naokomc commented 7 months ago

A new pledging organization reported this issue, and I tested it to confirm the same behavior.

Steps to Reproduce

  1. Create a new organization pledge from https://wordpress.org/five-for-the-future/for-organizations/
  2. Receive an email titled "Please confirm your email address" with a link
    Screenshot_2024_02_01_10_43
  3. Click the link in the email
  4. You will see "This pledge has been removed..." error
    image

The newly created Organization Pledge CPTs are in Draft status. These are examples of failed entries:

This entry also had the same issue, but I manually published it and now it's all fine. The email sent via the "Edit Pledge" link on the front page works. https://wordpress.org/five-for-the-future/wp-admin/post.php?post=37263&action=edit

Expected Behavior

Clicking the email in the first email should enable the organization admin to confirm the email address.

pkevan commented 7 months ago

I wasn't able to reproduce this with a new pledge, but can see it failing for the example ones - still investigating.

naokomc commented 7 months ago

@pkevan - Thank you for testing. Would it be possible for any of the submitted content (or lack of something) to trigger the "removed" message?

pkevan commented 7 months ago

Would it be possible for any of the submitted content (or lack of something) to trigger the "removed" message?

Possible - I didn't get much further in testing it, but will continue and update with any findings.

pkevan commented 7 months ago

Seems like the initial confirmation step isn't being triggered with the current code for some reason - it hasn't changed in the very long time, so i'm guessing it might be some incompatibility in core WP, or something that has changed with shortcode handling.

pkevan commented 7 months ago

So it seems like it's breaking at the point of sending the confirmation email: https://github.com/WordPress/five-for-the-future/blob/production/plugins/wporg-5ftf/includes/pledge.php#L359-L364

Instead of grabbing the current post id of the form, it grabs the pledge id, and sends that e.g.

https://wordpress.org/five-for-the-future/?post_type=5ftf_pledge&p=37897&action=confirm_pledge_email&pledge_id=37897&auth_token=

both p and pledge_id are the same.

pkevan commented 7 months ago

Fixed has been released on the site, so should be working again.