WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Is there a way to add a new field?

[Resolved] Is there a way to add a new field?

  • katie_thompson
    Member

    @katie_thompson

    Hello!

    First of all, I love this plugin. It is possibly the most polished plugin I have ever used!

    I do have a question though, is it possible to add another field? When a customer signs up for the mailing list, I need them to be able to also enter their birthday for our birthday coupons.

    Thanks!
    -Katie

    https://wordpress.org/plugins/optin-forms/

Viewing 15 replies - 1 through 15 (of 39 total)
  • Plugin Author Boris Beo
    Member

    @brs

    Hey Katie,

    First of all, thank you for the amazing compliment 🙂

    Secondly, adding a custom field is not built into the plugin at this time. However, it can easily be done by adding some additional code to the plugin.

    The negative aspect of editing code would be that you would have to repeat the process each and every time you update the plugin to a new version. So in terms of usability, I’m not sure if it’s an ideal solution.

    Tell me more about the form of your choice, which design are you using? Is the birthday field a text field, or do you need drop-down selection for year, month and day?

    katie_thompson
    Member

    @katie_thompson

    Understood. I’ll be the one updating plugins so it’s not a big deal. If it works, it will absolutely be worth it.

    I’m using the #5 form design.
    I’m thinking a text field with a required format of mm/dd/yyyy would be easier. I say this because with a drop-down menu, eventually the years would have to be updated. My client is planning to use MailChimp but it isn’t set up as of yet, so I’m not sure if there is a required way for the fields to be entered. I’m sure you would know more about that than me.

    And thanks so much for the amazingly fast response, yet another reason why this plugin is top notch!

    Plugin Author Boris Beo
    Member

    @brs

    Hi Katie,

    Here’s how you can do it. This will place the birthday field under the email field on form design 5.

    First edit the following file: wp-content/plugins/optin-forms/css/optinforms.css

    Find line #57 #optinforms-form5-email-field{...} and copy it. Paste it under line #57 and change #optinforms-form5-email-field to #optinforms-form5-birthday-field.

    I’m guessing this field will need its own icon, so simply change the background: url(../images/icon-email-01.png value to an icon of your choice. Don’t forget to upload your icon to wp-content/plugins/optin-forms/images folder. Your icon will need to be 25×16 pixels.

    Now that we have the CSS part, we need to add the new field to our posts and pages.

    We need to edit the following file: wp-content/plugins/optin-forms/includes/functions-forms.php

    Scroll down to line #218. You will need to look very carefully for the following code:

    <input type=\"text\" id=\"optinforms-form5-email-field\" name=\"" . optinforms_get_email_field() . "\" placeholder=\"" . optinforms_form5_default_email_field() . "\" style=\"font-family:" . optinforms_form5_default_fields_font() . "; font-size:" . optinforms_form5_default_fields_size() . "; color:" . optinforms_form5_default_fields_color() . "\" />

    Right after the closing bracket, add the following code:

    <input type=\"text\" id=\"optinforms-form5-birthday-field\" name=\"BDAY\" placeholder=\"Enter Your Birthday MM-DD-YYYY\" style=\"font-family:" . optinforms_form5_default_fields_font() . "; font-size:" . optinforms_form5_default_fields_size() . "; color:" . optinforms_form5_default_fields_color() . "\" />

    We’re almost there. You need to edit the name=\"BDAY\" value from BDAY to the birthday field identifier with MailChimp (or any other email solution you end up using).

    Also, change the placeholder text. I’ve set it up as Enter Your Birthday MM-DD-YYYY but you can easily change it to whatever works for you.

    Once again, you would need to repeat these steps each and every time you update the plugin.

    Hope you get it done and it works as you expected 😉

    katie_thompson
    Member

    @katie_thompson

    Wow, you are awesome!! I’m going to give it a try and let you know if I have anymore questions! THANKS A MILLION!!!!!!!!! 😀

    katie_thompson
    Member

    @katie_thompson

    It worked perfectly, you are brilliant!

    Do you know if MailChimp or other services have an option to store physical addresses too? I could add that to this form using the same method and give customers more options!

    Plugin Author Boris Beo
    Member

    @brs

    Thanks Katie,

    Glad I could help out 😉

    I’m sure you can set up MailChimp to collect additional user information. You would need to refer to their user manual, and repeat the above process for any additional fields you are using.

    Boris I am using form 1 and would like to add a phone number to the form is that possible?
    Thanks in advance….

    OK, Boris. I got the phone number on the form and it is working however the submit button is in the wrong place how can I fix it?

    Thanks again

    Boris, I got the phone number in however the submit button shows first before the phone take a look please. http://www.K9-University.com it is toward the bottom.

    Where did I go wrong?

    Thanks…

    Well now I messed it up so I am back to no phone box. Please tell me what I need to do to make it work. I need to make each box smaller so they will all fit on one line.

    Thanks

    Plugin Author Boris Beo
    Member

    @brs

    Hi k9u,

    Try adding this to your custom CSS field (under Form Options):

    #optinforms-form1-name-field-container,#optinforms-form1-email-field-container,#optinforms-form1-button-container{width:23%!important;}#optinforms-form1-phone-field{display:inline;float:left;margin:0 2% 0 0;width:23%;}

    Let me know if it works!

    I am not sure where you mean for it to go.

    Do you mean: wp-content/plugins/optin-forms/css/optinforms.css

    Thanks

    Plugin Author Boris Beo
    Member

    @brs

    Hi k9u,

    the code needs to be added to the Custom CSS field in Optin Forms itself.

    Go to your WordPress administration panel, click on Optin Forms in the navigation menu, click on the Form tab, click on Form Options and you will see a Custom CSS field. Paste the code there and click on Save Settings at the bottom of the page.

    Yes that did it. Boris you are the greatest. It really helps when you know what you are doing!

    Thanks….

    Plugin Author Boris Beo
    Member

    @brs

    Thank you! Glad you got it working 😉

Viewing 15 replies - 1 through 15 (of 39 total)
  • The topic ‘[Resolved] Is there a way to add a new field?’ is closed to new replies.