to dir
cp/wp plugin: contact form 7 NOTES                      rev 2 jan 2022

Category: forms
cp/wp: classicpress and wordpress 
webwalker: essential

.......................................................
description: 

  Make forms, including complex ones.
  I like it because it is NOT a gui.
  Great how-to articles on the website contactform7.com

  support: good. 

  privacy: dunno. 

  CP compat:  > v.5.3 according to the maker [aug 2021]
    Later versions of CF7 require WordPress 5+
       but are reported to actually work fine with CP/WP4.n
  CP support: No.
  Version recommendation: FREEZE at 5.1.6

.......................................................
sources: 

  Plugin page:
    https://wordpress.org/plugins/contact-form-7
    https://contactform7.com/faq/

  Other releases:
    https://contactform7.com/category/releases

  WordPress forums:
    https://wordpress.org/support/plugin/contact-form-7
    https://wordpress.org/search/classicpress+contact-form-7/?forums=1
  ClassicPress forums:
    https://forums.classicpress.net/search?q=%22contact%20form%207%22


_______________________________________________________ 
➽ Install/config/uninstall:

.........................
requires: TBD

   php: > v.n.n
   wp:  >= v.5.0 - use CF7 5.1.9 for CF/WP 4.9
     https://forums.classicpress.net/t/contactform7-prevents-migrating-to-cc/2653
   memory, anything else TBD


.........................
recommended related plugins: TBD
  Really simple captcha or other simple captcha plugin.
  Flamingo or other plugin to store forum results.


......................... 
install:

  the usual.


......................... 
settings:

  Has its own sidebar menu.

  How to set up a form and mail it:
    https://contactform7.com/setting-up-mail/



.........................
uninstall:

  - deletes from database.

  So - if you have to uninstall/reinstall for some reason, and you want to 
  keep your forms, do not uninstall through the interface.
  To keep your forms, remove the plugin from the wp-content/plugins folder, 
  then re-install it through the wordpress interface.

  tables: 



_______________________________________________________ 
➽ Notes:

.........................
redirect to another page after form submittal:

(The method using on_sent_ok hook is no longer recommended.)
Use CF7's custom DOM event to run JavaScript:

<script>
  document.addEventListener( 'wpcf7mailsent', function( event ) {
    location = 'http://example.com/';
  }, false );
</script>

source: https://contactform7.com/redirecting-to-another-url-after-submissions/


.........................
captcha:

  This year the author changed the captcha from a nice simple one.
  The default is now Google reCaptcha, which has severe privacy issues
  and as of dec 2019 has performance issues and is breaking forms.

  Advise using plugin Really Simple CAPTCHA
    https://wordpress.org/plugins/really-simple-captcha/



.........................
loading JavaScript and stylesheet only where used:

  "there is a technical difficulty for a plugin in knowing
    whether the page contains contact forms or not at the start of
    loading. However, I can show you a way to work around that."

   https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/
 
.........................
form tags:

  How tags work
	https://contactform7.com/tag-syntax/#mail_tag
  Special mail tags
  	https://contactform7.com/special-mail-tags/
  Search - all articles about mail tags
  	https://contactform7.com/?s=mail+tags

v.5.0: 
	New special mail tags: 
    	[_site_title], [_site_description], [_site_url], [_site_admin_email], [_invalid_fields], 
    	[_user_login], [_user_email], [_user_url], [_user_first_name], [_user_last_name], 
       		[_user_nickname], [_user_display_name]
    New filter hooks: 
      	wpcf7_upload_file_name, wpcf7_autop_or_not, wpcf7_posted_data_{$type},
            wpcf7_mail_tag_replaced_{$type}
    New form-tag features: 
         zero-controls-container, not-for-mail


.........................
upload files: how to change uploaded filename

  filter hook wpcf7_upload_file_name 
    https://wordpress.org/support/topic/set-uploaded-file-name/
    [25 sep 2019]


.........................
uploaded files info:

  uploaded files are saved temporarily in  /wp-content/uploads/wpcf7_uploads 
  This is the temporary upload file path. 
  Files will delete immediately after few seconds,
    after the mail is sent.
  
  You can change the temporary folder name by
  WPCF7_UPLOADS_TMP_DIR  constant in wp-config.php.
  define( 'WPCF7_UPLOADS_TMP_DIR', '/your/file/path' );

  Change maximum upload size in
    php.ini
    .htaccess
    wp-config.php
    functions file

  https://wpdebuglog.com/forums/topic/contact-form-7-file-upload/


.........................
uploaded files: how to save on server

  Save uploaded files by custom plugin or theme functions.php file. 

  We can catch uploaded file by wpcf7_before_send_mail action hook 
  and WPCF7_Submission class instance.  WPCF7_Submission class
  is a singleton class. It means it instantiates only one time. We
  can access as an object by get_instance() function. 

  Example code:
    add_action('wpcf7_before_send_mail', 'save_application_form' );
    function save_application_form($wpcf7) {
    $submission = WPCF7_Submission::get_instance();
        $files = $submission->uploaded_files();
    }

  https://wpdebuglog.com/forums/topic/contact-form-7-file-upload/
  more at: 
  https://wordpress.org/support/topic/contact-form-7-file-upload-creates-random-folder-and-stores-uploads-inside-that/

.........................
spam prevention - captchas:

  Google reCaptcha, which is recommended and included by the contact form 7 author,
  is a privacy violator, annoying to users, and way overkill for most of us.
  Also in late 2019 its new version is causing big problems with contact form 7.

  Strongly recommend another captcha: Really Simple CAPTCHA 
    which is also written and supported by author of contact form 7.
    https://wordpress.org/plugins/really-simple-captcha

  For something really simple, you can use CF7's 'quiz' type:
     https://contactform7.com/quiz/


.........................
date format:

  [_date] tag used in email will follow the Date Format 
    in your Settings &gt; General.



.........................
sending problems:

  Can be affected by your web host's spam rules, forwarders, dns spf record,
  rules and settings in security and other plugins, and more. 
  So you may want to check those things as well when having mail sending 
  problems from CF7.

  CF7 by itself has never had problems for me in all the years i have used it.
  oct 2020 - This year i have started having problems -
    Randomly, an email from form will not be received by recipient.
    Usually i have email to recipient, and copy to sender -- it is usually the 
      email to recipient that is not received.
    Researching this - 17 oct 2020
      - is using  wp_mail() function. (CHECK THIS)
      - https://contactform7.com/faq/i-see-green-border-response-but-i-never-receive-mail/
          "Showing the green border message means that the PHP function for sending the mail has certainly completed successfully. So if you can’t receive the mail, it’s highly possible that the mail has been kidnapped or killed after that.
          If you can check the log of your mail server, it could give you some clues. Spam filter often causes this kind of problem."
      - https://contactform7.com/best-practice-to-set-up-mail/

      - exactly my problem here: [7 oct 2020]
          https://wordpress.org/support/topic/some-email-not-arrvies/
          no replies yet - [17 oct 2020]
      - and here: [7 oct 2020]
         "auto-confirmation email is sent to the sender of the contactform, also green bar with confirmation appears to the sender."
          https://wordpress.org/support/topic/not-receiving-emails-on-successful-submission/
          no replies yet - [17 oct 2020]


    



.........................
security:

  A case of spammer sending through form not filling it in from the page,
  but directly using the API path used by the CF7 plugin, suach as
      /wp-json/contact-form-7/v1/contact-forms/159/feedback
  -- https://wordpress.org/support/topic/getting-spam-emails-using-json-api-url/#post-11997308



......................... 
passing values dynamically to a text field
  
  Is possible. Haven't tried it.
  https://wordpress.org/support/topic/passing-values-dynamically-to-a-text-field/



.........................
conditional fields:

  There is a plugin for that. Haven't tried it.
  https://wordpress.org/plugins/cf7-conditional-fields/


.........................
custom result pages such as error, spam, thankyou:

  Uses DOM events.
  Have used for thank you page on a few sites.
  https://contactform7.com/dom-events/



.........................
custom php-generated dropdown by shortcode

  Is possible. Haven't tried it.
  https://wordpress.org/support/topic/validate-custom-dropdown-inserted-by-shortcode/



.........................
getting values dynamically

  https://contactform7.com/getting-default-values-from-shortcode-attributes/
  https://wordpress.org/support/topic/cf7-set-dynamic-default-values-for-checkbox/

.........................
multiple mail results:

  Mail(2) etc is sent only when the primary Mail has been sent successfully.
  https://wordpress.org/support/topic/what-is-mail-2/


.........................
save form results to database:

  Flamingo (written by CF7 author)
    good, but not my fave because it saves data as 
      in existing wp table.
    doesn't save the attachments?
    assumes default field tags, not the ones you make?

  Contact Form 7 Database Addon – CFDB7
  https://wordpress.org/plugins/contact-form-cfdb7/
  By Arshid
  Saves in separate table.
  Good ratings, high usage.
    saves the attachments?


.........................
customising:

  Contact Form 7 Cookbook - 
    A series of articles to help developers customize Contact Form 7
    https://contactform7.com/category/cookbook



.........................
privacy friendly:

  - Privacy Notices section in the plugin page.
  - How to Make Privacy-Friendly Contact Forms 
      https://contactform7.com/2018/04/16/how-to-make-privacy-friendly-contact-forms/

    https://wordpress.org/support/topic/ccpa-compliance-3/#post-12360254
    [24 jan 2020]



.........................
form mails being seen as spam:

  Setting up mail (header and message) properly is essential for 
    successful mail delivery.
    https://contactform7.com/best-practice-to-set-up-mail/



.........................
configure date format:

  usual date shortcode is like [date-914]
  Can change it to like
    [_format_date-914 "d-m-Y"]
    https://wordpress.org/support/topic/date-format-for-contact-7/#post-12231692


.......................................................
more info:



.......................................................
other plugins of same type:

  all the other ones are more gui, impose their own design, etc.
    [2019]

  FluentForm is supposed to support ClassicPress,
    but it appears to be very gui-oriented.
    https://wordpress.org/plugins/fluentform/
    [aug 2021]


_______________________________________________________
begin  1 dec 2019
-- 0 --