"Integration" add_action('admin_menu', array($this, 'register_gs_menu_pages')); // load the js and css files add_action('init', array($this, 'load_css_and_js_files')); // load the classes add_action('init', array($this, 'load_all_classes')); // Add custom link for our plugin add_filter('plugin_action_links_' . GS_CONNECTOR_BASE_NAME, array($this, 'gs_connector_plugin_action_links')); add_filter( 'plugin_row_meta', [ $this, 'plugin_row_meta' ], 10, 2 ); add_action('wp_dashboard_setup', array($this, 'add_gs_connector_summary_widget')); add_action('admin_init', array($this, 'run_on_upgrade')); // redirect to integration page after update add_action('admin_init', array($this, 'redirect_after_upgrade'), 999); } /** * Plugin row meta. * * Adds row meta links to the plugin list table * * Fired by `plugin_row_meta` filter. * * @since 1.1.4 * @access public * * @param array $plugin_meta An array of the plugin's metadata, including * the version, author, author URI, and plugin URI. * @param string $plugin_file Path to the plugin file, relative to the plugins * directory. * * @return array An array of plugin row meta links. */ public function plugin_row_meta( $plugin_meta, $plugin_file ) { if ( GS_CONNECTOR_BASE_NAME === $plugin_file ) { $row_meta = [ 'docs' => '' . esc_html__( 'Docs', 'gsconnector' ) . '', 'ideo' => '' . esc_html__( 'Support', 'gsconnector' ) . '', ]; $plugin_meta = array_merge( $plugin_meta, $row_meta ); } return $plugin_meta; } /** * Do things on plugin activation * @since 1.0 */ public function gs_connector_activate($network_wide) { global $wpdb; $this->run_on_activation(); if (function_exists('is_multisite') && is_multisite()) { // check if it is a network activation - if so, run the activation function for each blog id if ($network_wide) { // Get all blog ids $blogids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->base_prefix}blogs"); foreach ($blogids as $blog_id) { switch_to_blog($blog_id); $this->run_for_site(); restore_current_blog(); } return; } } // for non-network sites only $this->run_for_site(); } /** * deactivate the plugin * @since 1.0 */ public function gs_connector_deactivate($network_wide) { } /** * Runs on plugin uninstall. * a static class method or function can be used in an uninstall hook * * @since 1.5 */ public static function gs_connector_free_uninstall() { global $wpdb; Gs_Connector_Free_Init::run_on_uninstall_free(); if (!is_plugin_active('cf7-google-sheets-connector-pro/google-sheet-connector-pro.php') || (!file_exists(plugin_dir_path(__DIR__) . 'cf7-google-sheets-connector-pro/google-sheet-connector-pro.php') )) { return; } if (function_exists('is_multisite') && is_multisite()) { //Get all blog ids; foreach of them call the uninstall procedure $blog_ids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->base_prefix}blogs"); //Get all blog ids; foreach them and call the install procedure on each of them if the plugin table is found foreach ($blog_ids as $blog_id) { switch_to_blog($blog_id); Gs_Connector_Free_Init::delete_for_site_free(); restore_current_blog(); } return; } Gs_Connector_Free_Init::delete_for_site_free(); } /** * Validate parent Plugin Contact Form 7 exist and activated * @access public * @since 1.0 */ public function validate_parent_plugin_exists() { $plugin = plugin_basename(__FILE__); if ((!is_plugin_active('contact-form-7/wp-contact-form-7.php') ) || (!file_exists(plugin_dir_path(__DIR__) . 'contact-form-7/wp-contact-form-7.php') )) { add_action('admin_notices', array($this, 'contact_form_7_missing_notice')); add_action('network_admin_notices', array($this, 'contact_form_7_missing_notice')); deactivate_plugins($plugin); if (isset($_GET['activate'])) { // Do not sanitize it because we are destroying the variables from URL unset($_GET['activate']); } } } /** * If Contact Form 7 plugin is not installed or activated then throw the error * * @access public * @return mixed error_message, an array containing the error message * * @since 1.0 initial version */ public function contact_form_7_missing_notice() { $plugin_error = Gs_Connector_Utility::instance()->admin_notice(array( 'type' => 'error', 'message' => __('Google Sheet Connector Add-on requires Contact Form 7 plugin to be installed and activated.', 'gsconnector') )); echo $plugin_error; } /** * Create/Register menu items for the plugin. * @since 1.0 */ public function register_gs_menu_pages() { if (current_user_can('wpcf7_edit_contact_forms')) { $current_role = Gs_Connector_Utility::instance()->get_current_user_role(); add_submenu_page('wpcf7', __('Google Sheets', 'gsconnector'), __('Google Sheets', 'gsconnector'), $current_role, 'wpcf7-google-sheet-config', array($this, 'google_sheet_configuration')); } } /** * Google Sheets page action. * This method is called when the menu item "Google Sheets" is clicked. * @since 1.0 */ public function google_sheet_configuration() { include( GS_CONNECTOR_PATH . "includes/pages/google-sheet-settings.php" ); } /** * Google Sheets page action. * This method is called when the menu item "Google Sheets" is clicked. * * @since 1.0 */ public function google_sheet_config() { // if (isset($_GET['code'])) { // $cf7gsc_code = sanitize_text_field($_GET['code']); // update_option('is_new_client_secret_cf7gscfree', 1); // $header = admin_url('admin.php?page=wpcf7-google-sheet-config'); // } else { // $cf7gsc_code = ""; // $header = ""; // } $cf7gsc_code = ""; $header = ""; if (isset($_GET['code'])) { if (is_string($_GET['code'])) { $cf7gsc_code = sanitize_text_field($_GET['code']); } update_option('is_new_client_secret_cf7gscfree', 1); $header = esc_url_raw(admin_url('admin.php?page=wpcf7-google-sheet-config')); } ?>


On deactivation, all your data saved with authentication will be removed and you need to reauthenticate with your google account.            

gsheet_print_google_account_email(); if ($email_account) { ?>

     

We do not store any of the data from your Google account on our servers, everything is processed & stored on your server. We take your privacy extremely seriously and ensure it is never misused.
Learn more.

CF7 Google Sheet Connector Pro - Amazing Key Features Common Features of GSheetConnector Pro Plugins.

One-Click Authentication

Get spreadsheet and Worksheet list directly to your contact form’s google sheet settings with one-click authentication.

Auto Fetch Sheets and Integration

You can add multiple Contact Forms of your site to multiple Google Sheets. And can add as many Google Sheets as forms.

Google Sheets API Up to date

One of the features you get with the latest API-V4 is the ability to format content in Google Sheets. when using our addon plugins.

Map Contact Form Mail Tags to GSheet Columns

In the Google sheets tab, provide column names in row 1. The first column should be “date” for each.

Quick Configuration

The Configuration of the form to the GSheet is very easy. Just follow the steps provided by the plugin and you will get data on the GSheet.

Support WordPress Multi-site

The Configuration of the form to the GSheet is very easy. Just follow the steps provided by the plugin and you will get data on the GSheet.

See Demo See All Futures & Buy Now

Next steps…

Product Support

upgrade_database_40(); } // update the version value $google_sheet_info = array( 'version' => GS_CONNECTOR_VERSION, 'db_version' => GS_CONNECTOR_DB_VERSION ); // check if debug log file exists or not $logFilePathToDelete = GS_CONNECTOR_PATH . "logs/log.txt"; // Check if the log file exists before attempting to delete if (file_exists($logFilePathToDelete)) { unlink($logFilePathToDelete); } update_site_option('google_sheet_info', $google_sheet_info); } public function upgrade_database_40() { global $wpdb; // look through each of the blogs and upgrade the DB if (function_exists('is_multisite') && is_multisite()) { //Get all blog ids; $blog_ids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->base_prefix}blogs"); foreach ($blog_ids as $blog_id) { switch_to_blog($blog_id); $this->upgrade_helper_40(); restore_current_blog(); } return; } $this->upgrade_helper_40(); } public function upgrade_helper_40() { // Add the transient to redirect. set_transient('cf7gs_upgrade_redirect', true, 30); } public function redirect_after_upgrade() { if (!get_transient('cf7gs_upgrade_redirect')) { return; } $plugin_options = get_site_option('google_sheet_info'); if ($plugin_options['version'] == "4.0") { delete_transient('cf7gs_upgrade_redirect'); wp_safe_redirect('admin.php?page=wpcf7-google-sheet-config'); } } /** * Add custom link for the plugin beside activate/deactivate links * @param array $links Array of links to display below our plugin listing. * @return array Amended array of links. * * @since 1.5 */ public function gs_connector_plugin_action_links($links) { // We shouldn't encourage editing our plugin directly. unset($links['edit']); // Add our custom links to the returned array value. return array_merge(array( '' . __('Settings', 'gsconnector') . '', '' . __('Upgrade to PRO', 'gsconnector') . '', ), $links); } public function add_gs_connector_summary_widget() { wp_add_dashboard_widget('gs_dashboard', __('Contact Form 7 - GSheetConnector', 'gsconnector') . "", array($this, 'gs_connector_summary_dashboard')); } public function gs_connector_summary_dashboard() { include_once( GS_CONNECTOR_ROOT . '/includes/pages/cf7gs-dashboard-widget.php' ); } /** * Called on activation. * Creates the site_options (required for all the sites in a multi-site setup) * If the current version doesn't match the new version, runs the upgrade * @since 1.0 */ private function run_on_activation() { $plugin_options = get_site_option('google_sheet_info'); if (false === $plugin_options) { $google_sheet_info = array( 'version' => GS_CONNECTOR_VERSION, 'db_version' => GS_CONNECTOR_DB_VERSION ); update_site_option('google_sheet_info', $google_sheet_info); } else if (GS_CONNECTOR_DB_VERSION != $plugin_options['version']) { $this->run_on_upgrade(); } } /** * Called on activation. * Creates the options and DB (required by per site) * @since 1.0 */ private function run_for_site() { if (!get_option('gs_access_code')) { update_option('gs_access_code', ''); } if (!get_option('gs_verify')) { update_option('gs_verify', 'invalid'); } if (!get_option('gs_token')) { update_option('gs_token', ''); } } /** * Called on uninstall - deletes site_options * * @since 1.5 */ private static function run_on_uninstall_free() { if (!defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN')) { exit(); } delete_site_option('google_sheet_info'); } /** * Called on uninstall - deletes site specific options * * @since 1.5 */ private static function delete_for_site_free() { if (!is_plugin_active('cf7-google-sheets-connector-pro/google-sheet-connector-pro.php') || (!file_exists(plugin_dir_path(__DIR__) . 'cf7-google-sheets-connector-pro/google-sheet-connector-pro.php') )) { delete_option('gs_access_code'); delete_option('gs_verify'); delete_option('gs_token'); delete_post_meta_by_key('gs_settings'); } } } // Initialize the google sheet connector class $init = new Gs_Connector_Free_Init();