"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.
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.
Get spreadsheet and Worksheet list directly to your contact form’s google sheet settings with one-click authentication.
You can add multiple Contact Forms of your site to multiple Google Sheets. And can add as many Google Sheets as forms.
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.
In the Google sheets tab, provide column names in row 1. The first column should be “date” for each.
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.
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.