Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP 1.5b2 – BP Options per site

  • @feedmymedia

    Participant

    Hello,

    We would like the buddypress options to appear on the site admin page of each site on our network, instead of on the network admin page. One of the main reasons we need this is because some of the sites on the network are in non-english languages. The ability to define specific titles and slugs for each bp component page per site is thus necessary.

    I would try activating the buddypress plugin per site, but it appears that the plugin can only be network-activated. (doesn’t appear on site admin / plugins ).

    Is it possible to display the bp options per site? Using WP 3.2.1 and latest BP 1.5b2.

    Thanks,

Viewing 8 replies - 1 through 8 (of 8 total)
  • @boonebgorges

    Keymaster

    Do you want to share the same content on all sites? That is, do you want groups, profiles, etc to be the same across your network?

    If yes, then put the following in your wp-config.php file:
    `define( ‘BP_ENABLE_MULTIBLOG’, true );`

    If no (you want each site to have its own groups, profiles etc), try this:
    http://rml.me/i

    @feedmymedia

    Participant

    Thanks Boone. Actually, having deactivated and activated the plugin for the umpteenth time, we’re now getting the options per site (literally minutes after my forum post, as it goes ;) ).

    Will definitely look into the BP multi-network plugin, looks like we might need it. It’s my understanding that the only way to have new posts and comments show up in the activity stream is by activating the site tracking component. However, surely this means that all posts and comments from across the network will appear in the stream. Is it not possible to only feature posts / comments from the current site, or is this where the multi-network plugin comes in?

    Appreciate the help.

    @boonebgorges

    Keymaster

    Yes, it is possible to keep posts and comments from specific blogs from being posted across the network. The idea is to intercept the bp_blogs_record_post() and bp_blogs_record_comment() functions, and unhook them when necessary.

    Say, for example, you don’t want any items from blogs 4, 6, or 10 to appear in the stream. Do this:
    `function bbg_limited_blog_activity() {
    global $wpdb;

    $blacklist = array( 4, 6, 10 );

    if ( in_array( $wpdb->blogid, $blacklist ) ) {
    remove_action( ‘save_post’, ‘bp_blogs_record_post’, 10, 2 );
    }
    }
    add_action( ‘save_post’, ‘bbg_limited_blog_activity’, 5 );`

    Similarly for bp_blogs_record_comment(), which is hooked to comment_post and edit_comment.

    For a whitelist, just switch the in_array logic around.

    @feedmymedia

    Participant

    Thanks a lot. In our case each site on the network will be using buddypress, but they won’t be sharing posts / comments between them. Also, all of these sites are sharing a single child theme. I suppose I could add a condition to the function to whitelist only the current site id, preventing updates streaming in from any of the other sites. Will give it a shot.

    @boonebgorges

    Keymaster

    > I suppose I could add a condition to the function to whitelist only the current site id

    Yes.

    @boonebgorges

    Keymaster

    Though I should note that checking the *current* site id is probably not what you want, since that function fires from the individual sites themselves. (And the current site is always equivalent to the current site.) You may want to check $wpdb->blogid == BP_ROOT_BLOG

    @feedmymedia

    Participant

    I see what you mean – I tried the following function:

    `function limit_blog_activity() {
    global $wpdb;

    if ( $wpdb->blogid != BP_ROOT_BLOG ) {
    remove_action( ‘save_post’, ‘bp_blogs_record_post’, 10, 2 );
    }
    }
    add_action( ‘save_post’, ‘limit_blog_activity’, 5 );`

    This doesn’t have any effect, since the site where the post is saved will always equal BP_ROOT_BLOG.

    Would it not be a better idea to limit the activity loop to only display activity from the current site? I’ve taken a quick look at the bp_has_activities function and it looks like this might be achievable through ‘primary_id’ and ‘secondary_id’ parameters, but am not entirely sure how I would apply this.

    Or do you have any other suggestions to limit updates, posts and comments to current site dynamically?

    Thanks.

    @boonebgorges

    Keymaster

    > This doesn’t have any effect, since the site where the post is saved will always equal BP_ROOT_BLOG.

    I think that’s wrong. The site where the post is saved will be the site where the post is saved. If you have an MS install with three blogs:
    1 – Boone’s Blog
    2 – Feedmymedia’s blog
    3 – Our BuddyPress community site (BP_ROOT_BLOG)

    when you publish a post on blog 1, $wpdb->blogid should equal 1, which is not the same as BP_ROOT_BLOG. Thus, your code should keep the item from being saved in the database.

    It’s possible that I’m still misunderstanding what you’re intending to do, though.

    What kinds of tests have you run on the code above? Did you do some var_dumps to make sure that the save_post hook is catching, and the function is being run? Did you see whether $wpdb->blogid actually does match BP_ROOT_BLOG in that case?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘BP 1.5b2 – BP Options per site’ is closed to new replies.
Skip to toolbar