Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add User to Blog as Subscriber on Registration


  • thecorkboard
    Participant

    @thecorkboard

    WP MultiSite v4.1
    BP v2.1.1

    Situation:
    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.

Viewing 3 replies - 1 through 3 (of 3 total)

  • mrjarbenne
    Participant

    @mrjarbenne

    I’m not sure if this is helpful. On our BP Network users are automatically added as a Subscriber on the main site (this is default BP behaviour) and then we use this plugin to create a widget on subsites for users to either automatically, or through a request process, get added to subsites across the network.

    It’s not exactly what you are going for, but it might meet the same goal:

    https://github.com/hwdsbcommons/wp-ms-request-membership


    thecorkboard
    Participant

    @thecorkboard

    Thanks, @mrjarbenne. That’s still a step or two too many, in my opinion. I get a lot of flustered students who get a little turned off by the registration process, and I’m trying to streamline things as much as possible. I’ll let you know if I come up with anything.


    thecorkboard
    Participant

    @thecorkboard

    @mrjarbenne, I’ve made some progress using @sbrajesh’s very fine BuddyPress Multi Network plugin. Now it seems that I get the effect I want as long as students register at each sub-network registration page. I have an issue with blog posts showing up in the activity stream, but that’s for another forum topic…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add User to Blog as Subscriber on Registration’ is closed to new replies.
Skip to toolbar