Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: limit 1 blog per user


produlz
Participant

@produlz

I found a solution, but I’m not a PHP programmer, It’s a hack of the code of this topic https://mu.wordpress.org/forums/topic.php?id=5930

Let’s go only if you are using the lasted trunk:

Open the mu-plugins/bp-blogs/bp-blogs-templatetags.php – Find this code starting at line 682 end at 696

<?php printf(__("By filling out the form below, you can <strong>add a blog to your account</strong>. There is no limit to the number of blogs you can have, so create to your heart's content, but blog responsibly.", 'buddypress'), $current_user->display_name) ?>

<?php _e("If you’re not going to use a great blog domain, leave it for a new user. Now have at it!", 'buddypress') ?>

<form id="setupform" method="post" action="<?php echo $bp->loggedin_user->domain . $bp->blogs->slug . '/create-a-blog' ?>">

<input type="hidden" name="stage" value="gimmeanotherblog" />
<?php do_action( "signup_hidden_fields" ); ?>
<?php bp_blogs_signup_blog($blogname, $blog_title, $errors); ?>

<input id="submit" type="submit" name="submit" class="submit" value="<?php _e('Create Blog &raquo;', 'buddypress') ?>" />

<?php wp_nonce_field( 'bp_blog_signup_form' ) ?>
</form>

Replace using this newbie code:

// One Blog Only HACK START
<?php $blogscheck = get_blogs_of_user($current_user->ID);
$blogarrayvalue = (get_object_vars($blogscheck[1]));
$blogsiteURL = "http://locutorpro.com.br";
if ($blogarrayvalue[siteurl] == $blogsiteURL)
{
echo "";
printf(__("By filling out the form below, you can <strong>add a blog to your account</strong>.", 'buddypress'), $current_user->display_name);
echo "
";
printf(__("If you’re not going to use a great blog domain, leave it for a new user. Now have at it!", 'buddypress'));
echo "
";
echo "<form id='setupform' method='post' action='";
echo $bp->loggedin_user->domain . $bp->blogs->slug ;
echo "/create-a-blog'>";
echo "<input type='hidden' name='stage' value='gimmeanotherblog' />";
echo do_action( "signup_hidden_fields" );
echo bp_blogs_signup_blog($blogname, $blog_title, $errors);
echo "<input id='submit' type='submit' name='submit' class='submit' value='";
printf(__("Create Blog &raquo;"));
echo "' />
"; echo wp_nonce_field( 'bp_blog_signup_form' );
echo "</form>";
}
else
{
printf(__("Sorry, you can have 1 blog only.", 'buddypress'));
}
?>
// One Blog Only HACK END

I hope it help!

Thank you for all dev team!

Skip to toolbar