WordPress.org

Support

Support » Multisite » [Resolved] Automatically Be Added as SuperAdmin to User Created Multisites

[Resolved] Automatically Be Added as SuperAdmin to User Created Multisites

  • Is there any way that I can automatically be added as a user and SuperAdmin of user-created multi-sites.

    Basically, I want the site, once created to be listed under “My Sites.”

    Any ideas? Thanks.

    -Nick

Viewing 3 replies - 1 through 3 (of 3 total)
  • Here’s a code snippet in a file in my “mu-plugins”

    <?php
    add_action( 'wpmu_new_blog', 'ds_new_user_meta', 10, 2 );
    function ds_new_user_meta($blog_id, $user_id) {
    add_user_to_blog($blog_id, '1', 'administrator' ); // adds SuperAdmin to the blog a user just created
    }
    ?>

    The ‘1’ is my SuperAdmin ID, but you may have other ID # as SuperAdmin.

    So, did you just make this a standalone, single-function plugin, or did you tag it on to another one of your plugins? I’m just trying to understand your process.

    Thanks for the code! It’s one of those things that seems so obvious once you actually see it.

    I owe you a virtual drink! haha

    -Nick

    EDIT: Since I didn’t make it clear here, I put that code in a plugin wrapper, uploaded it, activated it ONLY on the base URL, (Not network activated) and it works perfectly…hence me owing you an e-Drink. I was just curious about your implementation.

    My process: I have a “mu-plugins” folder in wp-content. I add snippets such as this in its own *.php file and away it goes – no fancy plugin wrapper needed.

    I spend more time fiddling/testing/tuning via ftp in the “mu-plugins” – my preference.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Automatically Be Added as SuperAdmin to User Created Multisites’ is closed to new replies.
Skip to toolbar