Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Only one blog for user


Burt Adsit
Participant

@burtadsit

OK people this seems to work. This requires modifying the member theme since I didn’t find any actions in bp to hook this into so here goes:

In the member theme the file:

/buddypress-member/blogs/create.php

There is this chunk of code:

<?php if ( bp_blog_signup_enabled() ) : ?>

..(some other stuff here)..

<?php else: ?>

<div id=”message” class=”info”>

<p><?php _e( ‘Blog registration is currently disabled’, ‘buddypress’ ); ?></p>

</div>

<?php endif; ?>

Replace the ..(some other stuff here).. with this:

<?php

global $bp;

$blogs = bp_blogs_get_blogs_for_user($bp->loggedin_user->id);

if (!$blogs)

{

bp_show_blog_signup_form();

}

else

{

?>

<div id=”message” class=”info”>

<p><?php _e( ‘Limit one Blog per member’, ‘buddypress’ ); ?></p>

</div>

<?php

}

?>

This is the entire little create.php file in pastie: http://pastie.org/396083

This was a: “quick ya we should have that and I’ve got to get to the store and get some boxes because I’m moving from Michigan where we have a snow storm today and Virginia where I’m moving to comes to a screeching halt when they get 1″ of snow and I gotta run now” solution.

When I get back from the store I’ll help clean up the damage this might cause. This does work for me in a quick test.

Skip to toolbar