I checked out the plugin and it didn’t work. I have been experimenting with code snippets in my theme’s function.php file and am getting close to a solution but haven’t fixed the problem yet.
The first snippet:
function add_new_user_to_mainsite($blog_id, $user_id) {
????add_user_to_blog( $blog_id, $user_id, ‘contributor’ );
}
add_action(‘user_register’, ‘add_new_user_to_mainsite’);
This snippet does add the registered user to the main site (according to my admin panels). But after the user clicks on confirmation email, the page that is supposed to display the user’s password states that this snippet triggered a fatal error. Nonetheless, when I visit my user list in the admin panels I do see that this user successfully registered with my main blog.
The second snippet:
function add_user_to_mainsite(){
global $current_user,$blog_id;
add_user_to_blog($blog_id, $current_user->ID, “contributor”);
}
add_action(‘wp’, ‘add_user_to_mainsite’, 10);
This snippet runs to make sure that the logged in user is registered with my main site and does not trigger any errors. Unfortunately, it only works when a logged in user visits the admin panels for his/her second time. The first time a newly registered user logs in he/she still sees the global dashboard. If, while logged in, the user visits the main site, and then clicks “site admin” he/she is redirected to the main blog. This is getting closer but I need to completely prevent the user from ever seeing the global dashboard so I guess I’m looking for some happy harmony between the first two snippets.
I am still teaching myself php so any help perfecting these snippets would be much appreciated. I have already spent many hours experimenting with different action hooks, revising the syntax, and trying to blend the two snippets but so far I have been unsuccessful. I based the two snippets off the following sites: Snippet 1, Snippet 2.