Advanced Contact form 7 DB Shortcodes

Below, you’ll find a detailed guide on how to add the Advanced Contact form 7 DB Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Advanced Contact form 7 DB Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Advanced Contact form 7 DB Plugin and the shortcodes it provides:

Plugin Icon
Advanced Contact form 7 DB

"Advanced Contact Form 7 DB is a WordPress plugin that securely saves all your Contact Form 7 submissions to your database, ensuring no data loss and providing easy access to your records."

★★★★☆ (40) Active Installs: 90000+ Tested with: 6.2.3 PHP Version: 7.4
Included Shortcodes:
  • [cf7-db-display-ip]
  • [acf7db]

Advanced Contact form 7 DB [cf7-db-display-ip] Shortcode

The Advanced CF7 DB plugin shortcode ‘cf7-db-display-ip’ is used to display the IP address. It checks if the WordPress installation is multisite and verifies the site ID. If conditions are met, it defines ‘vsz_cf7_display_ip’ as true.

Shortcode: [cf7-db-display-ip]

Parameters

Here is a list of all possible cf7-db-display-ip shortcode parameters and attributes:

  • site_id – The unique identifier for a specific site within a multisite network

Examples and Usage

Basic example – The following shortcode is a basic usage example of the ‘cf7-db-display-ip’ shortcode. It will display the IP address where the Contact Form 7 was submitted.

[cf7-db-display-ip]

Advanced examples

The shortcode ‘cf7-db-display-ip’ can also be used with the ‘site_id’ parameter. This parameter is useful when you are working in a multisite environment and you want to display the IP address of the submission based on a specific site id. The shortcode will check if the current site id matches with the provided site id, if it does, it will display the IP address.

[cf7-db-display-ip site_id=2]

In another advanced usage scenario, you can use the ‘cf7-db-display-ip’ shortcode without any parameters. In this case, the shortcode will display the IP address of the submission for the current site, regardless of whether it is a multisite or not.

[cf7-db-display-ip]

PHP Function Code

In case you have difficulties debugging what causing issues with [cf7-db-display-ip] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'cf7-db-display-ip',array($this,'cf7_db_vsz_cf7_display_ip'));

Shortcode PHP function:

function cf7_db_vsz_cf7_display_ip($atts, $content, $name){

		if(is_multisite()){
			$arrInfo = shortcode_atts( array( 'site_id' => ''),$atts );
			$check_id = sanitize_text_field($arrInfo['site_id']);
			$current_id = get_current_blog_id();

			if(!empty($check_id)){
				if($current_id == $check_id){
					define('vsz_cf7_display_ip',true);
				}
			}
			else{
				define('vsz_cf7_display_ip',true);
			}
		}
		else{
			define('vsz_cf7_display_ip',true);
		}

	}

Code file location:

advanced-cf7-db/advanced-cf7-db/admin/class-advanced-cf7-db-admin.php

Advanced Contact form 7 DB [acf7db] Shortcode

The Advanced Contact Form 7 DB shortcode is a powerful tool that enables the display of form submissions on the front-end. This shortcode, when added, calls the vsz_acf7_db_shortcode_display_front function. This function, in turn, requires and returns the ‘vsz_acf7_db_shortcode_display_front.php’ file from the plugin’s directory. This file is responsible for displaying the form submissions on the front-end of the website.

Shortcode: [acf7db]

Examples and Usage

Basic example – A simple usage of the ‘acf7db’ shortcode without any parameters.

[acf7db /]

PHP Function Code

In case you have difficulties debugging what causing issues with [acf7db] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'acf7db', array( $this, 'vsz_acf7_db_shortcode_display_front' ));

Shortcode PHP function:

function vsz_acf7_db_shortcode_display_front($atts, $content, $name){
		return require plugin_dir_path( __FILE__ ) . 'partials/vsz_acf7_db_shortcode_display_front.php';
	}

Code file location:

advanced-cf7-db/advanced-cf7-db/public/class-advanced-cf7-db-public.php

Conclusion

Now that you’ve learned how to embed the Advanced Contact form 7 DB Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *