How do I know if a user has a blog in WordPress Multisite?

I have a WordPress Multisite installation with Buddypress. I would want to restrict people from creating another blog so that they have only one blog.

How do I achieve this?

1 Answer
1

Check the user meta key primary_blog:

$user_has_blog = get_user_meta( $user_id, 'primary_blog', TRUE );

For users without a blog $user_has_blog will be false now. For other users $user_has_blog is the blog ID.

Leave a Comment