Limit users to only having one blog?
Im pretty new to buddypress, but have worked with WP (and WPMU) quite some time.
I have just set up a clean buddypress installation on kennethsblog.dk and is testing it out untill the right domain becomes available early in april.
I would like to limit my users to having one blog only, and not the oppitunity to create more. Is there a way to do that? Or should I just comment out the option in adminbar.php?
https://buddypress.org/forums/topic.php?id=1328 see that topic for a solution Kenneth.
Or, look here https://buddypress.org/extend/plugins/
Hmm. Where did that come from? Must be brand spanking new.
I took a look at this issue and found that the wpmu functions such as get_blogs_of_user() return all blogs that a user has any capability in. That means that if I’m an author on some blog it reports back that blog also. The post i quoted above and the solution was for blogs *created* by a user. I couldn’t find any way other than looking in bp, which tracks blog creation and not just membership.
wp doesn’t track blog creation, only blog capabilities. It couldn’t care less who created the blog. When sombody creates a blog they become an Administrator. The role Administrator doesn’t mean anything really. I can make somebody a blog admin and they never created the blog. bp tracks blog creation either through bp or wpmu.
Damn, thats some real fast answering there!
Im trying out the plugin – thanks both of ya
Oh well, the joy didnt last that long..
After trying the plugin it seems that no mather how many blogs I permit, an already registrered user cant create a new blog. If a user, who has no blog but just a username, tries to create blog number 1 he/she gets the ‘Blog creation is closed’-message.
Setting the number at the options-tab to 10 or 100 doesnt make a difference. Deleting the plugin-file makes it all work again.
I haven\\\’t tried that plugin Kenneth. I do know that others have had success with the solution outlined in the forum topic above. It\\\’s just not the most elegant solution because bp doesn\\\’t have any hooks for blog creation right now. Gotta hack the theme.
I thought I put in a ticket for a blog creation hook. Guess I didn\’t. I turned the red light on in this topic because I don’t have time to hunt down the best spot for a hook at the moment. I’ll lose track of this thread if it doesn’t stand out. Or somebody else could do it! (hint)
Thanks I’ll try to make the plugin work – just mailed the developer.
Any help is of course greatly appreciated
Please see this posting. I had the same question and this worked for me:
Plugin name:Limit Blogs per User
Plugin Author:Brajesh K. Singh
add_filter(\”wpmu_active_signup\”,\”tiw_check_current_users_blog\”); //send fake/true enable or disabled request
add_action(\”wpmu_options\”,\”tiw_display_options_form\”); //show the form to allow how many number of blogs per user
add_action(\”update_wpmu_options\”,\”tiw_save_num_allowed_blogs\”);//action to save number of allowed blogs per user
/****Check ,whether blog registration is allowed,and how many blogs per logged in user is allowed */
if( !is_user_logged_in() )
return $active_signup;//if the user is not logged in,do not change the site policies
$blogs=get_blogs_of_user($current_user->ID);//get all blogs of user
//if number of allowed blog is greater than 0 and current user owns less number of blogs */
/****How many blogs are allowed per user *************/
$num_allowed_blog=get_site_option(\”tiw_allowed_blogs_per_user\”);//find how many blogs are allowed
return $num_allowed_blog;//return the number of allowed blogs
/*****Show the Number of Blogs to restrict per user at the bottom of Site options ****/
<h3><?php _e(\’Limit Blog Registrations Per User\’) ?></h3>
<th scope=\”row\”>Number of blogs allowed per User</th>
<input type=\”text\” name=\”num_allowed_blogs\” value=\”<?php echo tiw_num_allowed_blogs()?>\” />
<p>If the Value is Zero, It indicates any number of blog is allowed</p>
/**************Save the Number of blogs per user when the form is updated **************/
$allowed_number_of_blogs=intval($_POST[\”num_allowed_blogs\”]);//how many blogs the user has set
//save to the database
You can set the number of blog you would like to allow.. its not mine, just wanna share it..
EDIT: to set the number of blogs, proceed to Site Admin/Options/ then look below..
- The topic ‘Limit users to only having one blog?’ is closed to new replies.