0

I know there are various plugins out there to help with multisite user management, but we have a policy of avoiding plugins for a) overzealous security policies, and b) interfering with our already heavily-modified WordPress installation (this has bit us before).

Also, simply adding all ~10,000 users to this one blog seems inelegant. That's a lot of new entries in wp_usermeta.

Is there any filter or action I can intercept to say "if this is blog X, then let any registered user through"? The admin_init action hook lets me restrict users according to arbitrary criteria, but I don't know how to let them through.

0

You could filter get_blogs_of_user and add this particular blog to the returned list. Pseudo-code, not tested:

add_filter( 'get_blogs_of_user', 'add_special_blog', 10, 3 );

function add_special_blog( $blogs, $user_id, $all )
{
    $new_blog = get_blog_details( $special_blog_id );

    $blogs[ $special_blog_id ] = (object) array(
    'userblog_id' => $special_blog_id,
    'blogname'    => $new_blog->blogname,
    'domain'      => $new_blog->domain,
    'path'        => $new_blog->path,
    'site_id'     => $new_blog->site_id,
    'siteurl'     => $new_blog->siteurl,
    'archived'    => 0,
    'spam'        => 0,
    'deleted'     => 0
    );

    return $blogs;
}
  • Thanks, awesome idea (didn't know about that filter!), but doesn't seem to work. Whereas before, I got the message 'You attempted to access the "Special Blog" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access... blah blah' After using this filter I get "You do not have sufficient permissions to access this page." Also I realized that these stuffed-in users probably won't have permissions to edit and publish posts. This method will probably be more trouble than it's worth... might just have to add every user to this blog. Thanks anyway – tobek Nov 12 '13 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.