Change New Site Comments Settings in Multisite

/*---------------------------NEW SITE DEFAULT COMMENTS OFF ---------------------------------------*/

function require_comment_login_wpmu_new_blog_example( $blog_id ) {

add_action( 'wpmu_new_blog', 'require_comment_login_wpmu_new_blog_example', 10, 1 );

This little function in a network activated plugin on WordPress multisite will require comment users to be a member of the multisite to comment. The setting can be changed by the blog admin but it makes the default setting a bit more restrictive.

It’s changing the value in Dashboard>Settings>Discussion.
Discussion settings panel in WordPress.