Usage
cf7_debug_info($cf7_instance)
Parameters
$cf7_instance
(Required) (Object) An instance of the CF7 form submission
Default: None
Parameter Notes
Use WPCF7_Submission::get_instance();
as the $cf7_instance parameter.
However, in most cases, child theme developers would interface with this function via the nebula_cf7_debug_info
filter.
Examples
Get an array of debug info
$nebula_debug_info = nebula()->cf7_debug_info(WPCF7_Submission::get_instance());
Add custom data to the debug information
add_filter('nebula_cf7_debug_info', function($debug_info){ //Add custom data to the debug info if ( get_option('tier_name') ){ $debug_info['tier'] = get_option('tier_name'); //Add an example item } return $debug_info; //Always return in filters! });
Remove data from the debug information
add_filter('nebula_cf7_debug_info', function($debug_info){ unset($debug_info['nebula_anonymized_ip']); //Remove this item return $debug_info; //Always return in filters! });
Additional Notes
This debug info is sent to the recipient of the form if the shortcode [debuginfo] appears in the message of the Contact Form 7 form settings.
This debug info is stored in WordPress within the Nebula CF7 Submissions custom post type (which appears within the “Contact” admin menu item). It may appear in other form storage systems like the Advanced CF7 DB plugin, but mileage may vary.
Source File
Located in /libs/Functions.php on line 3364.
1 Hook
Find these filters and actions in the source code below to hook into them. Use do_action() and add_filter() in your functions file or plugin.
Filters
"nebula_cf7_debug_info"Need a new filter hook? Request one here.
Actions
This function has no action hooks available. Request one?public function cf7_debug_info($submission, $submission_data=false){ global $wp_version; $debug_info = array(); $debug_info['wp_core_version'] = $wp_version; $debug_info['nebula_timestamp'] = date('U'); $debug_info['nebula_date_formatted'] = date('l, F j, Y \a\t g:ia'); $debug_info['nebula_version'] = $this->version('full') . ' (Committed ' . $this->version('date') . ')'; $debug_info['nebula_child_version'] = $this->child_version('full'); $debug_info['nebula_session_id'] = sanitize_text_field($this->nebula_session_id()); $debug_info['nebula_ga_cid'] = sanitize_text_field($this->ga_parse_cookie()); if ( !empty($submission_data) ){ $debug_info['nebula_current_page'] = sanitize_text_field(get_permalink($submission_data['_wpcf7_container_post'])); } $session_cookie_data = json_decode(stripslashes($this->super->cookie['session']), true); if ( isset($session_cookie_data['landing_page']) ){ $debug_info['nebula_referrer'] = sanitize_text_field($session_cookie_data['referrer']); //This is the original referrer (not just the previous page) $debug_info['nebula_landing_page'] = sanitize_text_field($session_cookie_data['landing_page']); //This is the first page view of the session } if ( $this->get_option('attribution_tracking') ){ //Don't output these unless this option is enabled (to prevent empty values from appearing like a lack of activity) $debug_info['nebula_utms'] = sanitize_text_field(htmlspecialchars_decode($this->utms())); //Check for PHP-based attribution cookie //Check for the JS-based attribution cookie if ( isset($this->super->cookie['attribution']) ){ $debug_info['nebula_attribution'] = sanitize_text_field($this->super->cookie['attribution']); } } //Staff if ( $this->is_dev() ){ $debug_info['nebula_staff'] = 'Developer'; } elseif ( $this->is_client() ){ $debug_info['nebula_staff'] = 'Client'; } elseif ( $this->is_staff() ){ $debug_info['nebula_staff'] = 'Staff'; } //Logged-in User Info if ( is_object($submission) ){ $user_id = (int) $submission->get_meta('current_user_id'); if ( !empty($user_id) ){ $user_info = get_userdata($user_id); $debug_info['nebula_user_id'] = $user_info->ID; $debug_info['nebula_username'] = $user_info->user_login; $debug_info['nebula_display_name'] = $user_info->display_name; $debug_info['nebula_email'] = $user_info->user_email; if ( get_the_author_meta('phonenumber', $user_info->ID) ){ $debug_info['nebula_phone'] = get_the_author_meta('phonenumber', $user_info->ID); } if ( get_the_author_meta('jobtitle', $user_info->ID) ){ $debug_info['nebula_job_title'] = get_the_author_meta('jobtitle', $user_info->ID); } if ( get_the_author_meta('jobcompany', $user_info->ID) ){ $debug_info['nebula_company'] = get_the_author_meta('jobcompany', $user_info->ID); } if ( get_the_author_meta('jobcompanywebsite', $user_info->ID) ){ $debug_info['nebula_company_website'] = get_the_author_meta('jobcompanywebsite', $user_info->ID); } if ( get_the_author_meta('usercity', $user_info->ID) && get_the_author_meta('userstate', $user_info->ID) ){ $debug_info['nebula_city_state'] = get_the_author_meta('usercity', $user_info->ID) . ', ' . get_the_author_meta('userstate', $user_info->ID); } $debug_info['nebula_role'] = $this->user_role(); } } //Bot detection if ( $this->is_bot() ){ $debug_info['nebula_bot'] = 'Bot detected'; } //WPML Language if ( defined('ICL_LANGUAGE_NAME') ){ $debug_info['nebula_language'] = ICL_LANGUAGE_NAME . ' (' . ICL_LANGUAGE_CODE . ')'; } //Device information if ( isset($this->super->server['HTTP_USER_AGENT']) ){ $debug_info['nebula_user_agent'] = sanitize_text_field($this->super->server['HTTP_USER_AGENT']); } $debug_info['nebula_device_type'] = ucwords($this->get_device('formfactor')); $debug_info['nebula_device'] = $this->get_device('full'); $debug_info['nebula_os'] = $this->get_os(); $debug_info['nebula_browser'] = $this->get_browser('full'); //Anonymized IP address $debug_info['nebula_anonymized_ip'] = sanitize_text_field($this->get_ip_address()); $debug_info = map_deep($debug_info, 'sanitize_text_field'); //Deep sanitization of the full data array return apply_filters('nebula_cf7_debug_info', $debug_info); }
Override
This function can not be short-circuited with an override filter. Request one?