Form Forge works on WordPress Multisite installations with per-site activation.
Network-Wide Considerations
Each site in the network gets its own set of database tables (wp_2_formforge_forms, wp_2_formforge_submissions, etc.) when the plugin is activated on that site. Forms and submissions are isolated per site.
Activating Across the Network
php
// In a must-use plugin or network admin script
if ( is_multisite() ) {
$sites = get_sites( [ 'number' => 100 ] );
foreach ( $sites as $site ) {
switch_to_blog( $site->blog_id );
if ( ! is_plugin_active( 'formforge/formforge.php' ) ) {
activate_plugin( 'formforge/formforge.php' );
}
restore_current_blog();
}
}Querying Forms Across Sites
php
function get_all_network_forms() {
$all_forms = [];
$sites = get_sites( [ 'number' => 100 ] );
foreach ( $sites as $site ) {
switch_to_blog( $site->blog_id );
if ( class_exists( 'FORMFORGE_Form_Builder' ) ) {
$forms = FORMFORGE_Form_Builder::instance()->get_all();
foreach ( $forms as $form ) {
$form->site_id = $site->blog_id;
$all_forms[] = $form;
}
}
restore_current_blog();
}
return $all_forms;
}Network Analytics Dashboard
php
add_action( 'wp_network_dashboard_setup', function() {
wp_add_dashboard_widget( 'ff_network_stats', 'Form Forge Network Stats', function() {
$sites = get_sites( [ 'number' => 50 ] );
echo '<table><tr><th>Site</th><th>Forms</th><th>Submissions</th></tr>';
foreach ( $sites as $site ) {
switch_to_blog( $site->blog_id );
global $wpdb;
$forms = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}formforge_forms" );
$subs = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}formforge_submissions" );
printf( '<tr><td>%s</td><td>%d</td><td>%d</td></tr>',
esc_html( get_bloginfo( 'name' ) ), $forms, $subs );
restore_current_blog();
}
echo '</table>';
} );
} );—