Skip to content

When a CF7 submission is un-spammed, it should be treated the same as an allowed form submission #166

Closed

Description

@crweiner

Description

When a Contact Form 7 (CF7) submission is marked as spam on https://opensource.org/ai/endorsements, it skips adding the submitter as a pending Supporter (a custom CPT).

However, if a CF7 submission is incorrectly categorized as spam, then manually marked as not spam in Flamingo, then the code in PR #162 is not being triggered.

We will look to see if there is a way to trigger the same code/hooks if a form submission is marked as not spam in Flamingo in the same way that it would have been triggered if the CF7 submission went through properly.

Image

See the following #149 and #162 for a background on the Supporter CPT and how it connects to CF7:

See the internal dev request for further information.

Activity

  1. changed the title [-]When a CF7 submission is un-spammed, it should be treated the same as an approved submission[/-] [+]When a CF7 submission is un-spammed, it should be treated the same as an allowed form submission[/+] on Feb 5, 2025
  2. nickpagz commented on Feb 12, 2025

    @nickpagz
    Collaborator

    @crweiner I've merged a fix to develop that should do the trick. To test it, add a new entry to the form, then edit the form in wp-admin at Flamingo > Inbound Messages by toggling it to spam then unspam (because there's no current spam entries on the staging site and your entry probably won't be spam either), it should create a new pending entry in "Supporters". The new pending "Supporter" should also only get created for "channels" from the "'OSAID Endorsement" form.

    Let me know.

  3. crweiner commented on Feb 12, 2025

    @crweiner
    Author

    Thanks so much, @nickpagz! I used the Akismet akismet‑guaranteed‑spam test line in the message body and Akismet marked it as Spam, as expected. When I then toggled the entry in Flamingo to Not Spam, I do see that it creates a pending entry to the Supporters CPT! 🎉

    A few things I noted, and I'm not sure if any of these need to be changed or not:

    • If the spam submission is toggled to Not Spam, then Spam, and back to Not Spam, it will create a duplicate pending entry in the Supporters CPT.
      • It also creates multiple Supporters entries if multiple spam submissions from the same individual are marked as Not Spam. If a message is marked as spam, then the CF 7 form says: "There was an error trying to send your message. Please try again later." This can lead to multiple submission attempts back-to-back, which is what we saw on prod, and possible extra Supporters entries if they are all marked as Not Spam.
    • The multiple Supporters CPT entries all have the same permalink, but different post IDs. Will this create an issue?

    cc: @ajolo2ky for their input (I'll also reach out via email)

  4. ajolo2ky commented on Feb 13, 2025

    @ajolo2ky
    Contributor

    Hi team,

    Thanks for the work on this issue!

    Having multiple entries under the same permalink shouldn't be a problem for us (although that shouldn't happen as a person should endorse it one time only), so if we have multiple records for the same person, that's ok from a functionality standpoint.

  5. nickpagz commented on Feb 14, 2025

    @nickpagz
    Collaborator

    @crweiner

    If the spam submission is toggled to Not Spam, then Spam, and back to Not Spam, it will create a duplicate pending entry in the Supporters CPT.

    That's a feature! Joking aside, yes, it does. I could possibly add tracking by setting some meta for converted spam entries, though I don't expect this to be a common thing to happen since it's an admin task to review these, so the impact should be minimal. If you think we need it I can investigate a solution.

    It also creates multiple Supporters entries if multiple spam submissions from the same individual are marked as Not Spam. If a message is marked as spam, then the CF 7 form says: "There was an error trying to send your message. Please try again later." This can lead to multiple submission attempts back-to-back, which is what we saw on prod, and possible extra Supporters entries if they are all marked as Not Spam.

    I wasn't aware CF7 did this, and digging deeper it seems this is "just how it works". Most people shouldn't be getting their entries marked as spam, but we could look at changing the messaging for this form (Messages tab) for the spam message to match the success message.

    The multiple Supporters CPT entries all have the same permalink, but different post IDs. Will this create an issue?

    When it's converted from pending to published the permalink is unique. Subsequent conversions get a -1, -2, etc. appended to the slug, so there's no issue/conflict.

    Let me know if we want to add tracking the conversion to non-spam to avoid the duplicates.

  6. crweiner commented on Feb 20, 2025

    @crweiner
    Author

    Thanks for digging further, @nickpagz!

    @ajolo2ky, after you have had some time to test this out in staging, can you please let us know if anything else needs to be changed or if we can merge it with prod?

  7. ajolo2ky commented on Feb 28, 2025

    @ajolo2ky
    Contributor

    Hi! Please promote it to production, thanks!

  8. crweiner commented on Feb 28, 2025

    @crweiner
    Author

    Thank you for that confirmation, @ajolo2ky!
    @nickpagz, feel free to push to prod when you're available, thanks! 😃

  9. ajolo2ky commented on Mar 3, 2025

    @ajolo2ky
    Contributor

    Hi team,

    Were you able to integrate this in production ?

    We are having some random posts going out via Nelio, related to CF7.

    Image

  10. nickpagz commented on Mar 7, 2025

    @nickpagz
    Collaborator

    @ajolo2ky This is now live on the production site. Please let me know if you notice any issues with the functionality.

  11. crweiner commented on Mar 7, 2025

    @crweiner
    Author

    Feel free to close this GH issue if you are satisfied with things, @ajolo2ky!

  12. ajolo2ky commented on Mar 7, 2025

    @ajolo2ky
    Contributor

    Thanks for the effot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions