The MU forums have moved to WordPress.org

activate buddypress on a site other than the current one? (6 posts)

  1. fleshins
    Member
    Posted 14 years ago #

    What's the right way to activate buddypress on a site other than the current one? I've tried switching to the site with:
    switch_to_blog( $blog_id );

    ... but activate_plugin("buddypress/bp-loader.php") fails (returns nothing).

    So how can I activate buddypress for say "site1.domain.com" when the php script is run from "domain.com"?

  2. fleshins
    Member
    Posted 14 years ago #

    setting $_SERVER['HTTP_HOST']="site1.domain.com" before you load the wp env does the trick :)

  3. andrea_r
    Moderator
    Posted 14 years ago #

    Um, there's other ways to do this built right in to BP. their forums have it.

  4. fleshins
    Member
    Posted 14 years ago #

    I was resorting to those hacks because switching to the blog and updating the active_plugins option wasn't working for some reason. Then magically it started to work. Go figure. Is this the other way you were thinking of or is there an even a simpler way?

    switch_to_blog($blog_id);
    update_option('active_plugins', array( "buddypress/bp-loader.php" ));
    restore_current_blog():

  5. andrea_r
    Moderator
    Posted 14 years ago #

    Let's go back to what you're originally trying to do. You want to run BP off something *other* than the main blogs, or as well as?

    Because that's two different answers. Neither one of which is what you did. Don;t use switch to blog. This is *built in* to BP and you're looking for hard answers when it's really easy. (and all over their site)

    From here:
    http://codex.buddypress.org/how-to-guides/changing-internal-configuration-settings/

    Set which blog ID BuddyPress will run on:
    define ( 'BP_ROOT_BLOG', $blog_id );

    Allow BuddyPress to function on multiple blogs of a WPMU installation, not just on one root blog:
    define ( 'BP_ENABLE_MULTIBLOG', true );

  6. fleshins
    Member
    Posted 14 years ago #

    Thanks Andrea. I'm using yours and ron's multi-site plugin. When a new site is created, I want buddypress to be automatically enabled with it.

    In the ra_add_site() function I simply call:
    update_option('active_plugins', array( "buddypress/bp-loader.php" ));

    Works like a charm. Thanks for your constant support and apologies for the confusion :)

About this Topic

  • Started 14 years ago by fleshins
  • Latest reply from fleshins