Using Gravity Forms ‘gform_user_registration_enable_multisite_section’ PHP filter

The gform_user_registration_enable_multisite_section filter enables the multisite section of User Registration feed settings network-wide, instead of only on the main site.

Usage

add_filter('gform_user_registration_enable_multisite_section', '__return_true');

Parameters

  • $enable_multisite_section (bool): Set to true or false to enable or disable the multisite section.

More information

See Gravity Forms Docs: gform_user_registration_enable_multisite_section

Place this code in the functions.php file of your active theme. The filter is located in GF_User_Registration::feed_settings_fields() in class-gf-user-registration.php. This filter was added in Gravity Forms User Registration Add-On 2.3.6.

Examples

Enable multisite section for all sites

Enable the multisite section of User Registration feed settings for all sites in the network.

add_filter('gform_user_registration_enable_multisite_section', '__return_true');

Disable multisite section for all sites

Disable the multisite section of User Registration feed settings for all sites in the network.

add_filter('gform_user_registration_enable_multisite_section', '__return_false');

Enable multisite section for specific sites

Enable the multisite section of User Registration feed settings only for sites with specific IDs.

function enable_multisite_section_for_specific_sites($enable_multisite_section) {
    $allowed_site_ids = array(2, 3, 4);
    if (in_array(get_current_blog_id(), $allowed_site_ids)) {
        return true;
    }
    return $enable_multisite_section;
}
add_filter('gform_user_registration_enable_multisite_section', 'enable_multisite_section_for_specific_sites');

Enable multisite section based on user role

Enable the multisite section of User Registration feed settings only for users with a specific role.

function enable_multisite_section_based_on_user_role($enable_multisite_section) {
    $user = wp_get_current_user();
    if (in_array('administrator', $user->roles)) {
        return true;
    }
    return $enable_multisite_section;
}
add_filter('gform_user_registration_enable_multisite_section', 'enable_multisite_section_based_on_user_role');

Enable multisite section for sites with specific theme

Enable the multisite section of User Registration feed settings only for sites using a specific theme.

function enable_multisite_section_for_specific_theme($enable_multisite_section) {
    $current_theme = wp_get_theme();
    if ('My Custom Theme' == $current_theme->name) {
        return true;
    }
    return $enable_multisite_section;
}
add_filter('gform_user_registration_enable_multisite_section', 'enable_multisite_section_for_specific_theme');