The add-on allows for automatic broadcasting of forms when the shortcode is found in a post.
The add-on automatically detects the [contact-form-7 id="123"] shortcode and broadcasts the associated form to each child blog.
Comments
If I understood correctly, after we added to the technical (hidden) cpt post with all the shortcodes, we need to update it immediately after the contact form 7 update.
You can use the following code (replacing your post type and post title)
add_action(‘wpcf7_after_save’, ‘update_tech_post’, 10, 1);
function update_tech_post($args)
{
if (get_current_blog_id() != 1) {
return;
}
global$wpdb;
$tech_post_id = $wpdb->get_var(“SELECT ID FROM wp_posts WHERE post_title = ‘Broadcast Contact Forms’ AND post_type = ‘tech'”);
If I understood correctly, after we added to the technical (hidden) cpt post with all the shortcodes, we need to update it immediately after the contact form 7 update.
You can use the following code (replacing your post type and post title)
add_action(‘wpcf7_after_save’, ‘update_tech_post’, 10, 1);
function update_tech_post($args)
{
if (get_current_blog_id() != 1) {
return;
}
global$wpdb;
$tech_post_id = $wpdb->get_var(“SELECT ID FROM wp_posts WHERE post_title = ‘Broadcast Contact Forms’ AND post_type = ‘tech'”);
ThreeWP_Broadcast()->api()->update_children($tech_post_id);
}
Looks good to me. I hope someone else finds a use for the code also!