formtools / core

The Form Tools Core.
https://formtools.org
207 stars 78 forks source link

Wordpress Contact Form 7 Integration #364

Open ocbroadband opened 5 years ago

ocbroadband commented 5 years ago

Anyone had any experience with integrating Formtools and using WP plugin, Contact Form 7? It has the ability to integrate to external applications, but I'm not quite sure if there is a capability of doing it with Formtools.

roberthro commented 5 years ago

Hey, in my case this work around was doing the job: Instead of using ....form method="post" action="/path/to/process.php".... I modified the process.php and added this changed process.php ij a Contact Form 7 action hook into functions.php in the wordpress theme. In my case I used wpcf7_custom_before_send_mail. There I added: require(get_template_directory() .'/../../../formtools/process_wpcf7.php');

In the modified process_wpcf7.php I declared some of the neccessary formtools variables as global just before the include of the core library functions:

global $g_db_hostname, $g_db_username, $g_db_password, $g_db_name, $g_unicode, $g_db_ssl, $g_check_ft_sessions, $g_set_sql_mode; global $LANG, $L, $g_root_dir, $g_root_url, $g_default_theme; global $g_max_nav_pages, $g_smarty_debug, $g_smarty, $g_smarty_use_sub_dirs, $g_table_prefix, $g_ft_tables; global $g_current_version, $g_release_type, $g_release_date, $g_multi_val_delimiter, $g_query_str_multi_val_separator, $g_api_version, $g_api_recaptcha_private_key;

regards, Christoph