WordPress.org

Forums

Optin Forms
[resolved] Is there a way to add a new field? (40 posts)

  1. katie_thompson
    Member
    Posted 1 year ago #

    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/

  2. Boris Beo
    Member
    Plugin Author

    Posted 1 year ago #

    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?

  3. katie_thompson
    Member
    Posted 1 year ago #

    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!

  4. Boris Beo
    Member
    Plugin Author

    Posted 1 year ago #

    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 25x16 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 ;)

  5. katie_thompson
    Member
    Posted 1 year ago #

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

  6. katie_thompson
    Member
    Posted 1 year ago #

    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!

  7. Boris Beo
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  8. k9u
    Member
    Posted 1 year ago #

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

  9. k9u
    Member
    Posted 1 year ago #

    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

  10. k9u
    Member
    Posted 1 year ago #

    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...

  11. k9u
    Member
    Posted 1 year ago #

    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

  12. Boris Beo
    Member
    Plugin Author

    Posted 1 year ago #

    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!

  13. k9u
    Member
    Posted 1 year ago #

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

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

    Thanks

  14. Boris Beo
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  15. k9u
    Member
    Posted 1 year ago #

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

    Thanks....

  16. Boris Beo
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you! Glad you got it working ;)

  17. k9u
    Member
    Posted 1 year ago #

    Boris, I have a new problem. My form in Aweber requires that all the fields be filled. However form1 will allow you to register without filling in all the fields. How can I fix this, it's important for me.

    Thanks

  18. Boris Beo
    Member
    Plugin Author

    Posted 1 year ago #

    Hi k9u,

    I've tried signing up with the following email address: test-/at-k9-university.com and you are right. People can sign up without entering their phone number.

    You may want to delete this test subscription email from your Aweber mailing list.

    To fix this, open the following file:
    /wp-content/plugins/optin-forms/includes/functions-forms.php

    Scroll to line 206.

    Find the following:
    <form method=\"post\" action=\"" . optinforms_get_form_action() . "\">

    change to:
    <form method=\"post\" action=\"" . optinforms_get_form_action() . "\"><input type="hidden" name="meta_required" value="name,email" /><input type="hidden" name="meta_required" value="name,email,phone" />

    Save the document and re-upload.

    Just like with creating this custom field in this form, keep in mind that you would have to repeat the process each and every time you update the plugin to a new version.

    At this time, we don't support adding custom fields to your forms. This also means that I'm helping out in any way I can, but I can't guarantee that it will keep working with any plugin updates. Hope you do understand ;)

  19. k9u
    Member
    Posted 1 year ago #

    Boris, thanks you for the reply however I can not find that code at 206 or anywhere close to it.

    Just to be sure you want me to be at :/wp-content/plugins/optin-forms/includes/functions-forms.php ? Is that correct?

    Where would it be, under what action title?

    Also you do not have to put in your name in the form either. Should this code fix that as well?

    Thanks

  20. Boris Beo
    Member
    Plugin Author

    Posted 1 year ago #

    Hi k9u,

    The code is part of the following function: function optinforms_create_form()

    If you're unable to find it, send me your WP admin login through our website and I will edit it for you.

    By default, aWeber only required an email address in order to sign up for a mailing list. This code adjustment will require all your fields to be filled in: name, email address and phone number.

  21. k9u
    Member
    Posted 1 year ago #

    Boris, I changed it but got this error message.

    Parse error: syntax error, unexpected T_STRING in /home/k9univer/public_html/wp-content/plugins/optin-forms/includes/functions-forms.php on line 411

    I tried changing back but still get message and my site is down.

    What do I need to do to get you to help me?

    How can I send you the file?

  22. k9u
    Member
    Posted 1 year ago #

    Can you just send me the corrected file?

    Thanks

  23. k9u
    Member
    Posted 1 year ago #

    Here is the code that has the problem:

    function optinforms_create_form() {
    
    	global $optinforms_form_design;
    
    	if($optinforms_form_design == 'optinforms_form_design_option1') {
    
    		return "" . optinforms_code_comment() . "<div id=\"optinforms-form1-container\" " . optinforms_form1_get_width() . "><form method=\"post\" action=\"" . optinforms_get_form_action() . "\">  optinforms_get_form_identifiers() . "<div id=\"optinforms-form1\" style=\"background:" . optinforms_form1_default_background() . "; border-color:" . optinforms_form1_default_border() . "\"><p id=\"optinforms-form1-title\" style=\"font-family:" . optinforms_form1_default_title_font() . "; font-size:" . optinforms_form1_default_title_size() . "; line-height:" . optinforms_form1_default_title_size() . "; color:" . optinforms_form1_default_title_color() . "\">" . optinforms_form1_default_title() ."</p><p id=\"optinforms-form1-subtitle\" style=\"font-family:" . optinforms_form1_default_subtitle_font() . "; font-size:" . optinforms_form1_default_subtitle_size() . "; line-height:" . optinforms_form1_default_subtitle_size() . "; color:" . optinforms_form1_default_subtitle_color() . "\">" . optinforms_form1_default_subtitle() . "</p><div id=\"optinforms-form1-name-field-container\"> <input type=\"text\" id=\"optinforms-form1-name-field\" name=\"" . optinforms_get_name_field() . "\" placeholder=\"" . optinforms_form1_default_name_field() . "\" style=\"font-family:" . optinforms_form1_default_fields_font() . "; font-size:" . optinforms_form1_default_fields_size() . "; color:" . optinforms_form1_default_fields_color() . "\" /></div><!--optinforms-form1-name-field-container--><div id=\"optinforms-form1-email-field-container\"><input type=\"text\" id=\"optinforms-form1-email-field\" name=\"" . optinforms_get_email_field() . "\" placeholder=\"" . optinforms_form1_default_email_field() . "\" style=\"font-family:" . optinforms_form1_default_fields_font() . "; font-size:" . optinforms_form1_default_fields_size() . "; color:" . optinforms_form1_default_fields_color() . "\" /></div><!--optinforms-form1-email-field-container--><input type=\"text\" id=\"optinforms-form1-phone-field\" name=\"phone\" placeholder=\"Phone\" style=\"font-family:" . optinforms_form1_default_fields_font() . "; font-size:" . optinforms_form1_default_fields_size() . "; color:" . optinforms_form1_default_fields_color() . "\" /><div id=\"optinforms-form1-button-container\"><input type=\"submit\" name=\"submit\" id=\"optinforms-form1-button\" value=\"" . optinforms_form1_default_button_text() . "\" style=\"font-family:" . optinforms_form1_default_button_text_font() . "; font-size:" . optinforms_form1_default_button_text_size() . "; color:" . optinforms_form1_default_button_text_color() . "; background-color:" . optinforms_form1_default_button_background() . "\" /></div><!--optinforms-form1-button-container--><div class=\"clear\"></div><p id=\"optinforms-form1-disclaimer\" style=\"font-family:" . optinforms_form1_default_disclaimer_font() . "; font-size:" . optinforms_form1_default_disclaimer_size() . "; line-height:" . optinforms_form1_default_disclaimer_size() . "; color:" . optinforms_form1_default_disclaimer_color() . "\">" . optinforms_form1_default_disclaimer() . "</p></div><!--optinforms-form1--><div class=\"clear\"></div>" . optinforms_powered_by() . "</form></div><!--optinforms-form1-container--><div class=\"clear\"></div>" . optinforms_code_comment_end() . optinforms_form1_add_custom_css() . "";

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

  24. Boris Beo
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry for that, I failed to do some editing to the code.

    This is the right one:
    <form method=\"post\" action=\"" . optinforms_get_form_action() . "\"><input type=\"hidden\" name=\"meta_required\" value=\"name,email,phone\" />

    I can send you the updated file, what's your email?

  25. k9u
    Member
    Posted 1 year ago #

    Thank you...

    wayne at iamcentral dot com

  26. Boris Beo
    Member
    Plugin Author

    Posted 1 year ago #

    No problem ;)

    Sent!

  27. k9u
    Member
    Posted 1 year ago #

    OK...the website is back up however the phone is now gone.

    Thanks!!!

    I guess I need to go back and do the steps above or is there a short cut to get the phone area back?

  28. Boris Beo
    Member
    Plugin Author

    Posted 1 year ago #

    Check your email again. I've sent you the file with phone field. Let me know if it works like it should ;)

  29. k9u
    Member
    Posted 1 year ago #

    yes, yes, yes

    That did it! It is perfect! and it works perfect!

  30. Boris Beo
    Member
    Plugin Author

    Posted 1 year ago #

    Great, glad it's working for ya :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Optin Forms
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.