Warning: Contact Form 7 - activetrail Add-on requires that you have the latest version of Contact Form 7 installed. Please upgrade now.
';
}
}
// If it's not installed and activated, throw an error
else {
echo '
Contact Form 7 is not activated. Contact Form 7 must be installed and activated before you can use the activetrail addon.
';
}
if( !class_exists( 'SoapClient' ) ){
echo '
Warning: Contact Form 7 - activetrail Add-on requires SoapClient php extension installed. Please add the extension via php.ini file or contact your hosting support.
';
}
}
add_action( 'admin_notices', 'cf7_activetrail_notice' );
/**
* Enable the ActiveTrail tags in the tag generator
*/
function cf7_activetrail_add_tag_generator() {
if( function_exists('wpcf7_activetrail_tag_generator') ) {
// Modify callback based on CF7 version
$callback = function_exists('wpcf7_add_meta_boxes') ? 'wpcf7_tag_generator_activetrail_old' : 'wpcf7_tag_generator_activetrail';
wpcf7_activetrail_tag_generator( 'activetrail', 'activetrail Fields', 'wpcf7-tg-pane-activetrail', $callback );
}
}
add_action( 'admin_init', 'cf7_activetrail_add_tag_generator', 99 );
/**
* Adds a box to the main column on the form edit page.
*
* CF7 < 4.2
*/
function cf7_activetrail_tag_add_meta_boxes() {
add_meta_box( 'cf7-activetrail-settings', 'activetrail Settings', 'cf7_activetrail_addon_metaboxes', null, 'form', 'low');
}
add_action( 'wpcf7_add_meta_boxes', 'cf7_activetrail_tag_add_meta_boxes' );
/**
* Adds a tab to the editor on the form edit page.
*
* CF7 >= 4.2
*/
function cf7_activetrail_tag_page_panels($panels) {
$panels['activetrail-panel'] = array( 'title' => 'Active Trail integration', 'callback' => 'cf7_activetrail_addon_panel_meta' );
return $panels;
}
add_action( 'wpcf7_editor_panels', 'cf7_activetrail_tag_page_panels' );
// Create the meta boxes (CF7 < 4.2)
function cf7_activetrail_addon_metaboxes11( $post ) {
// Add an nonce field so we can check for it later.
wp_nonce_field( 'cf7_activetrail_addon_metaboxes', 'cf7_activetrail_addon_metaboxes_nonce' );
wp_nonce_field( 'cf7_activetrail_addon_metaboxes11', 'cf7_activetrail_addon_metaboxes_nonce11' );
wp_nonce_field( 'cf7_activetrail_addon_metaboxes22', 'cf7_activetrail_addon_metaboxes_nonce22' );
wp_nonce_field( 'cf7_activetrail_addon_metaboxes33', 'cf7_activetrail_addon_metaboxes_nonce33' );
wp_nonce_field( 'cf7_activetrail_addon_metaboxes44', 'cf7_activetrail_addon_metaboxes_nonce44' );
wp_nonce_field( 'cf7_activetrail_addon_metaboxes55', 'cf7_activetrail_addon_metaboxes_nonce55' );
/*
* Use get_post_meta() to retrieve an existing value
* from the database and use the value for the form.
*/
$activetrail_addon_tag_value = get_post_meta( $post->id(), '_cf7_activetrail_addon_tag_key', true );
$activetrail_addon_tag_value11 = get_post_meta( $post->id(), '_cf7_activetrail_addon_tag_key11', true );
$activetrail_addon_tag_value22 = get_post_meta( $post->id(), '_cf7_activetrail_addon_tag_key22', true );
$activetrail_addon_tag_value33 = get_post_meta( $post->id(), '_cf7_activetrail_addon_tag_key33', true );
$activetrail_addon_tag_value44 = get_post_meta( $post->id(), '_cf7_activetrail_addon_tag_key44', true );
$activetrail_addon_tag_value55 = get_post_meta( $post->id(), '_cf7_activetrail_addon_tag_key55', true );
//echo ' ';
//echo '';
//echo '
Separate multiple tags with commas. These must already be defined in ActiveTrail.