[closed] Automatically add a new user to all blogs on network (18 posts)

  1. Alan
    Posted 5 years ago #


    Is it possible to automatically add a new user to all blogs on network. A plugin or code hack is fine, I just need to find a way..

    Edit: I know they have pseudo subscriber access but this doesn't seem to allow them to view private pages even when 'subscriber' has that capability assigned.. So i guess they need to be assigned to the blog in question..


  2. For all the stuff that was mu, the hacks & plugins codes are all still in the mu forums.


  3. Alan
    Posted 5 years ago #

    Oh ok, i have never used mu and as this is wordpress 3 i thought i was in the right place..

    I did try one mu plugin and it did not work, said it had not been tested with my version of wordpress, so I don't know if there is a solution or not.

    I will look through that list you posted some more but that is all mu stuff, but thanks anyway..

  4. you are in the right place.

    Everything that was mu is now in 3.0 as multisite. The examples in those threads may need some tweaks, but most likely will work straight away.

    If it says put it in the mu-plugins folder, just create that folder. it will works in 3.0 just like it did in mu.

  5. Alan
    Posted 5 years ago #

    yeah I found a bit of code that seems to do what I want, I have posted over there to see if someone can help me with an array, but I think I am getting close now..

    thanks for your help..

  6. Alan
    Posted 5 years ago #

    I probably shouldn't hijack someone else's thread so I will post it here..

    Is there a way to simplify this code (it works fine) to add a new user to all blogs without me having to list them in the $blogs array??


    add_action( 'user_register', 'ds_new_user_meta', 10, 2);
    function ds_new_user_meta($user_id) {
    $blogs = array(1,2,3,4,5,6,7,8,9,10);
    foreach ($blogs as $blog) {
    add_user_to_blog($blog, $user_id, 'subscriber');
    // adds every new user to blog_id 1 to 10
  7. Alan
    Posted 5 years ago #

    I think I have found a way to do this but as it involves putting a bit of code in a template page I posted a quick question here http://wordpress.org/support/topic/413326

    I am mainly worried about security issues though, so if anyone knows about templates and security could you have a quick look


  8. patung
    Posted 5 years ago #

    I just edited wp-signup.php to comment out the option to select 'gimme a site', then had 'just a username' checked by default - that forces all registrations through the main site, once they are logged in I make it clear, or will make it clear, how they can go about getting their own site.

  9. Alan
    Posted 5 years ago #

    I am trying to get all new users added to all (new and future) blogs though..

  10. patung
    Posted 5 years ago #

    Might help - http://wpmututorials.com/elsewhere/wpmu-default-user-role/ wouldn't work for future blogs though...

  11. Alan
    Posted 5 years ago #

    yeah, that's the first thing I tried.. Didn't seem to work at all though..

  12. craig552uk
    Posted 5 years ago #

    Automatically adding all users to all existing and future sites would be a key feature of our using WP for our Intranet platform.

    We're a large company (5k+ staff), so an automated solution is a must.

    The idea would be to give each department their own site. All staff would, by default, be subscribers of all sites (to enforce restricted access). Select individuals would be granted elevated privileges to create and manage content within certain sites.

  13. All staff would, by default, be subscribers of all sites (to enforce restricted access).

    This part is already built in. There's absolutely no need for anything extra if you want users to have subscriber-only access to all sites in the network.

    And it's also built in to add exisiting users to a particular site.

  14. idealien
    Posted 5 years ago #

    On a related scenario - what are recommended approaches to have a new user that registers automatically added to one of 3 (or more) blogs that are based on their region. I.e. If there is a drop-down question about nearest region on the registration form, that determines which blog they get added to in addition to the primary one.

  15. macbis
    Posted 5 years ago #

    I wrote this plugin to solve a similar issue that I was having. It works for me on WP 3.0.1, but I haven't thoroughly tested it and make no promises. It should, at least, provide a decent starting point for anyone that wants to hack on it.

    It should be placed in your mu-plugins folder.


    It'll add a newly registered user to your other network blogs and it will add existing users to newly created network blog. It will not copy preexisting users to preexisting blogs.

    If you encounter any problems or have suggestions, let me know (preferably through GitHub so as to not derail this topic for others).

  16. joshmac
    Posted 5 years ago #

    The multisite user management plugin maybe another alternative as well: http://wordpress.org/extend/plugins/multisite-user-management/

  17. agreda
    Posted 4 years ago #

    The examples in those threads may need some tweaks, but most likely will work straight away.

    Hi Andrea. You've mentioned before that all new registered users under WP 3.1 are automatically assigned Subscriber status to blog ID 1, but this clearly does not seem to be the case (at least at tripawds.com) as they are not listed under Site Admin as a user of the main site. The exception, however, is that new users who also create a blog/site are being assigned subscriber status to blog id 1. Those who create no site, are not.

    Now, we have been using the following in mu-plugins to automatically assign all new users main blog Subscriber status:

    function ds_new_user_meta($blog_id, $user_id) {
    add_user_to_blog('1', $user_id, 'subscriber' );
    add_action( 'wpmu_new_blog', 'ds_new_user_meta', 10, 2 );

    It's been working like a charm, until our 3.1 upgrade. Since then, only users who create a site are being added to the main site.

    So... My questions include:

    • Should all new users (with or without a bblog) appear as subscribers under the primary site admin / users?
    • Could this "new-user" plugin be keeping WP from doing its job?
    • Any suggested "tweaks" for getting this plugin working "straight away" under WP 3.1?

    Many thanks to all for any input.

    PS: Thanks for the multisite user management plugin lead, however, it appears to assign users to all sites, and we only want to add new users to site id 1.

    EDIT: I just now noticed how old this topic is. :-/ But it seemed the most relevant after searching these forums.

  18. agreda - Can you make a NEW topic for this?

Topic Closed

This topic has been closed to new replies.

About this Topic