Support » Networking WordPress » Automatically add a new user to all blogs on network

  • Alan

    (@holo-alan)


    Hello

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

    Cheers
    Alan

Viewing 15 replies - 1 through 15 (of 17 total)
  • Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

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

    http://www.google.com/search?sitesearch=mu.wordpress.org&q=add+user+to+all+blogs

    Alan

    (@holo-alan)

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

    Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    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.

    Alan

    (@holo-alan)

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

    Alan

    (@holo-alan)

    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??

    cheers

    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
    }
    Alan

    (@holo-alan)

    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

    cheers

    patung

    (@patung)

    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.

    Alan

    (@holo-alan)

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

    patung

    (@patung)

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

    Alan

    (@holo-alan)

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

    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.

    Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    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.

    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.

    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.

    http://github.com/nocash/wp-musersync/blob/master/MUserSync.php

    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).

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

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Automatically add a new user to all blogs on network’ is closed to new replies.