Gravity Forms Registration – Add User to Multiple Sites

You’ve got a scenario where someone is signing up to multisite via Gravity Forms’ user registration plugin. The following function will automatically add them to as many additional sites as you’d like.

add_action( 'gform_user_registered', 'many_site_registration_save', 10, 3 );

function many_site_registration_save( $user_id, $feed, $entry ) {
	$sites = array(25,26,27,28); //the IDs of the sites you want the user added to
	foreach ($sites as $site) {
		add_user_to_blog($site, $user_id, 'author'); //the last variable is the desired role for the user
	}
}

Comments on this post

  1. Jörg Pareigis said on January 25, 2019 at 1:57 pm

    Great to see how you fixed it!
    /Jörg

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trackbacks and Pingbacks on this post

No trackbacks.

TrackBack URL