Support » Plugin: Flamingo » Use different fields for "Subject" and From "Name "?

Viewing 8 replies - 1 through 8 (of 8 total)
  • +1 for that

    Hi, check out this temporary solution:
    http://wordpress.org/support/topic/subhect-and-date-fields?replies=5

    I hope something better comes along the way

    Dan

    Thread Starter saas

    (@saas)

    Nah its not the kind of solution I am looking for. Thanks anyway.

    Hi,

    You’ll have to edit the PHP code in the Flamingo module that’s a part of Contact Form 7.

    To do this, you’ll need to go to “Plugins” –> “Editor”. Then in the top right hand corner, select Contact Form 7 as the plugin you want to edit. Click Select.

    You’re looking for “contact-form-7/modules/flamingo.php”. Once you click on that file, scroll down close to the bottom, but not all the way. You’re looking for the following lines of code:

    $email = isset( $posted_data[‘your-email’] ) ? trim( $posted_data[‘your-email’] ) : ”;
    $name = isset( $posted_data[‘your-name’] ) ? trim( $posted_data[‘your-name’] ) : ”;
    $subject = isset( $posted_data[‘your-subject’] ) ? trim( $posted_data[‘your-subject’] ) : ”;

    These lines set what field name variables that Flamingo is looking for to set the values for the email, name and subject. Simply change the variable in both places of the line for each area that you’re trying to adjust.

    In my case, I created a form where people are entering their first name and last name in different fields.

    My new code for those three lines looks like this:

    $email = isset( $posted_data[‘your-email’] ) ? trim( $posted_data[‘your-email’] ) : ”;
    $first_name = isset( $posted_data[‘first-name’] ) ? trim( $posted_data[‘first-name’] ) : ”;
    $last_name = isset( $posted_data[‘last-name’] ) ? trim( $posted_data[‘last-name’] ) : ”;
    $name = $first_name . ” ” . $last_name;
    $subject = isset( $posted_data[‘your-subject’] ) ? trim( $posted_data[‘your-subject’] ) : ”;

    This way, Flamingo still interprets their first and last name as one name, but I get the variables to use in my email in different places, such as “Hello [first-name]” in the auto-receipt email that gets sent to them when they submit the form.

    In my case, I didn’t need to change the subject variable. Instead, I used the Contact Form 7 Modules plugin to insert a hidden field into the form that sets the subject to a static value.

    However, if you wanted to change it to something else in your form, like “company-name” for a field [company-name], just modify the code above in the appropriate places.

    I’ve additionally pasted this whole comment into Pastebin to ensure proper syntax just in case this comment doesn’t render correctly.

    http://pastebin.com/g9rEVRGm

    I hope this helps. 😉

    Can we separate this setting from the source code of it doesn’t get overwritten every time CF7 is updated?
    In my case, I removed all the ‘your-‘ from name and email to make the forms function better with autofill.

    Hi,

    I looked for that code allahjesus but couldn’t find it. Maybe there was an update?

    All my results are looking like:

    Subject: [your-subject]
    From: [your-name] <[your-email]>

    And so I can’t tell one from the other…. I have made several contact forms and custom fields.

    Actually I’d love to remap the subject as well, because in the listing, “your-subject” is the thing you click to see the inbound message, but my form doesn’t include a subject.

    if you all are still subscribed to this thread, the functionality already exists to control the data that flamingo uses

    http://wordpress.org/support/topic/inbound-messages-wrong-visualization?replies=2#post-5425678

    so in OP’s case, as long as you can load your data from a custom field or wherever into the CF7 field ID, & correctly display it in the mail settings or body, then it should work fine with flamingo

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Use different fields for "Subject" and From "Name "?’ is closed to new replies.