Support » Plugins » User 1 (Admin) added to all blogs

  • Hey WPMU users,

    I spent hours trawling these forums for the ability to add myself (the default user) as admin on all blogs on the system, I know it’s not neccesary because I have the power on all blogs but it’s an added deterrent for possible spammers if the site admin is registered on their blog… It’s also quite useful to keep track of all the blogs on the system by using

    $blogs = get_blogs_of_user(1);
    if ( ! empty($blogs) ) foreach ( $blogs as $blog ) {
    echo "<li><a href='" . $blog->domain . $blog->path . "'>" . $blog->domain . $blog->path . "</a></li>";

    So I took it upon myself to make it so that when a new blog is created, it adds the admin user to that blog! and just after I did this I thought….

    Why not allow other people to do this?

    So here’s how!




    function wpmu_create_blog($domain, $path, $title, $user_id, $meta = '', $site_id = 1) {
    $domain = addslashes( $domain );
    $title = addslashes( $title );
    $user_id = (int) $user_id;'

    Then, A little bit further down FIND:

    add_user_to_blog($blog_id, $user_id, ‘administrator’);

    after this line ADD:

    add_user_to_blog($blog_id, X, ‘administrator’);`

    where X is the userid of the user you wish to add, this can be repeated if you have multiple site admins ^_^


    Note that neither myself nor wordpress are responsible for the effects of this “hack”. You utilise it at your own risk! By using this solution you agree to indemnify all parties against any legal action arising!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘User 1 (Admin) added to all blogs’ is closed to new replies.