Add User to Blog as Subscriber on Registration
-
WP MultiSite v4.1
BP v2.1.1Situation:
Students self-register for user accounts and sites. As the instructor, I need them to also be auto-enrolled in the main course site, where the registration form is located.Question:
Are you aware of a function that can run when the registration form is submitted that will auto-enroll students to the main course site?From my searching, this seems to be on par, but I do not know how to integrate it with the register.php code:
add_action('wpmu_new_user', 'add_new_users_to_sites', 10, 2); function add_new_users_to_sites($user_id){ /** add_user_to_blog($site_id, $user_id, $user_role); */ add_user_to_blog('4', $user_id, 'subscriber'); }
I believe
wpmu_new_user
needs to be changed to
wpmu_create_user
. Ultimately, the function will be changed so as to “grab” the id of the current blog, so as to bypass the need to hardcode the site id into add_user_to_blog.
Thanks for any ideas you may have.
- The topic ‘Add User to Blog as Subscriber on Registration’ is closed to new replies.