Skip to:
Content
Pages
Categories
Search
Top
Bottom

limit 1 blog per user

  • @adamhdv

    Member

    I’ve read on a few different wpmu forums how to edit the wp-signup files so it’s possible to limit ONE blog per each member.

    Is there a way anyone knows how to limit this in buddypress? So when a member tries to create another blog it is disabled, (if they already have a blog)?

    thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • @adamhdv

    Member

    Anyone? :/

    @nicolagreco

    Participant

    It isn’t a buddypress configuration, but it depends on wp-mu.

    The choice are two: editing wp-signup, or install plug-ins and edit buddypress template, now it’s so complicated if you don’t know php or if you don’t want writing code..

    @adamhdv

    Member

    I have installed a few different plug-ins for wp-mu, neither have seemed to work when using buddypress. :(

    Maybe I should make sure I edited/installed/configured them right, think I did though…

    @nicolagreco

    Participant

    i think that you’ve to ask in wordpress-mu forum, not here..

    @adamhdv

    Member

    Good point.

    Just wondering if anyone knew anything that I didn’t…maybe.

    thanks though

    @neuromancer2701

    Participant

    @adamhdv

    Member

    neuromancer2701, that’s actually the exact modifications I did… for some reason buddypress lets more than one blog per person. I’ll look to make sure I installed it right.

    @neuromancer2701

    Participant

    I wanted to removed “Create a Blog!” from of the buddypress admin bar.

    This is what I got to work:

    wp-content/mu-plugins/bp-core/bp-core-adminbar.php

    $blogscheck = get_blogs_of_user($current_user->ID);
    if ( ! empty($blogscheck)
    {
    echo '<a href="' . $bp['loggedin_domain'] . $bp['blogs']['slug'] . '/create-a-blog">' . __("Create a Blog!", 'buddypress') . '</a>';
    }

    @cybernaga

    Member

    Hey neuromancer2701,

    Where in the file (line #, etc.) did you place this?

    Thanks.

    @produlz

    Participant

    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!

    @marco72

    Participant

    In $blogsite=URL you gotta fill in your URL. ;-)

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘limit 1 blog per user’ is closed to new replies.
Skip to toolbar