• We’re hoping to dynamically set the subject and email recipient of a Jetpack Contact based on a user’s Select block choice. Setting the Subject is easy because the content_form_subject filter provides $all_values with all the user’s form-field values. But I can’t do the same with content_form_to because it doesn’t send that data (only the $to value). Nor can I find any hook that fires before content_form_to that returns all the submitted-form values. (The akismet_ hooks have the “standard”/comment field vals — user name/email/message — but not any added fields.) Suggestions?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Bruce (a11n)

    (@bruceallen)

    Happiness Engineer

    Hi @hearvox

    I’m not sure I quite understand what you’re trying to accomplish. Can you give me the example usage of this? Like an overview of how this would work?

    We’re happy to help, we just need a little more information to see how we can best assist you!

    Thread Starter Barrett Golding

    (@hearvox)

    Sorry, I wasn’t clear. We at college/community radio station KGLT.net are building a new site. For the Contact page we’d like to use a single Jetpack Contact Form that allows the user to choose which staff member receives the form-submission info (via email). Here’s the barebones page with the form we’re testing:
    https://kgltradio.com/about/staff/

    The select pulldown, labeled “To:”, has the user-selectable options for the recipient (“General Manager”, “Music Director”, etc.). Using Jetpack’s content_form_subject filter, I can set the subject line of the email the staff member receives based the user-selected pulldown value (e.g., if val is “Music Director”, I set subject to “KGLT Music Director contact”). That’s easy because the filter passes all the user’s form-field values (in var $all_values, which includes that of the “To:” select pulldown).

    But the contact_form_to filter passes no user-entered values, only the form’s recipient (i.e., $to, preset in the page’s Block editor.) So I can’t get user’s “To:” selection, for setting email recipient. Nor I can’t find any hook that fires before contact_form_to that passes all the user’s form-field values, which I need to set recipient.

    Rather the write the form myself (or use another form plugin), I’d like to stick with Jetpack’s Contact Form, which we use elsewhere on site too: It’ll be easier for station to maintain/learn just one form plugin. Plus I really like how Jetpack’s integrates with Akismet and admin-lists under Feedback.

    So, any way to grab the user-selected value of the form’s pulldown before contact_form_to fires? Or any way to otherwise set the email recipient based on that user-selection? (Hope I’ve explained better this time.)

    Plugin Support Mehdi (a11n)

    (@muffinpeace)

    Hi @hearvox

    Thanks for providing that explanation! It makes absolute sense to me what you are looking to achieve now; however, we won’t be able to provide support with that as customization that involves custom development and coding is outside of our support scope.

    You may use the Jetpack Codex to find and search for filters related to the contact form, and you can also submit a Github issue as a Feature request related to your specific use case (of offering dropdown options to contact different people).

    Best,

    Thread Starter Barrett Golding

    (@hearvox)

    Feature request submitted. Thanks for your help and suggestion.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Contact Form: dynamic email recipient?’ is closed to new replies.