Skip to:
Content
Pages
Categories
Search
Top
Bottom

BuddyPress and Multi-Site issues

  • Multi Site is WPMU plugin to enable having multiple main sites on different domain ( and also creating new blogs under those domains).

    http://wspinacze.pl and http://climbers-blog.org

    – to enable registration of blogs on both domain i moved back to wp-signup.php due to redirection issues (in fact register works only on first domain – same with blogs, members. groups)

    – buddypress part is only avaiable on wspinacze.pl domain – do you have any idea to show it on both domains? if yes – what about different language on each domain?

    – i\\\’m not sure if that is really what i want to do – but does anybody have an idea how to separate buddypress part for each domain? in fact that would mean that only users are same across all domains.

    – there was a problem with logging to second domain through adminbar (it always uses first domain) – my solution was to do:

    remove_action( \\\’bp_adminbar_menus\\\’, \\\’bp_adminbar_login_menu\\\’, 2 );

    add_action( \\\’bp_adminbar_menus\\\’, \\\’my_bp_adminbar_login_menu\\\’, 2 );

    where my_… is function with proper url

    – what about enabling buddypress plugin on second domain? it makes possible using of buddypress widgets but isn\\\’t there any danger of overwriting data saved on first domain?

    As You can see- if somebody needs to have multiple domains with one buddypress – it\\\’s quite easy to achieve…

    (using buddypress rc2, wpmu 2.7.1, still not integrated bbpress, many additional plugins)

Viewing 15 replies - 1 through 15 (of 15 total)
  • Updated bp_adminbar_authors_menu to hide authors on additional main sites

    //HOOKS FOR TOP MENU - AUTHORS
    remove_action( 'bp_adminbar_menus', 'bp_adminbar_authors_menu', 12 );
    add_action( 'bp_adminbar_menus', 'my_bp_adminbar_authors_menu', 12 );
    // **** "Blog Authors" Menu (visible when not logged in) ********
    function my_bp_adminbar_authors_menu() {
    global $current_blog,$wpdb;

    $site_id = $wpdb->get_var( "SELECT COUNT(*) FROM wp_site WHERE id=".$current_blog->blog_id);

    //$numrows = $wpdb->num_rows($site_id);
    if ( $site_id!='1' ) {
    $authors = get_users_of_blog();

    if ( is_array( $authors ) ) {
    /* This is a blog, render a menu with links to all authors */
    echo '<li id="bp-adminbar-authors-menu" class="'.$site_id.'"><a href="/">';
    _e('Blog Authors', 'buddypress');
    echo '</a>';

    echo '<ul class="author-list">';
    foreach( $authors as $author ) {
    $author = new BP_Core_User( $author->user_id );
    echo '<li>';

    echo '<a href="' . $author->user_url . '">';
    echo $author->avatar_mini;
    echo ' ' . $author->fullname;
    echo '<span class="activity">' . $author->last_active . '</span>';
    echo '</a>';
    echo '<div class="admin-bar-clear"></div>';
    echo '</li>';
    }
    echo '</ul>';
    echo '</li>';
    }
    }
    }

    Ops – part to site_id should be as follows:

    function my_bp_adminbar_authors_menu() {

    global $current_blog,$wpdb;

    $blog_url = get_blog_option($current_blog->blog_id, 'siteurl' );

    $blog_url_pieces = explode("/", $blog_url);

    $blog_url = $blog_url_pieces[2];

    $site_id = $wpdb->get_var( "SELECT COUNT(*) FROM wp_site WHERE domain='".$blog_url."'");


    anemec
    Participant

    @anemec

    Were you also able to separate out the friends and groups so that the groups and friends associated with Site A were not seen by people on Site B?

    Not yet. To do that we’ll need to save also in buddypress tables id of assigned site, or – probably easier to accomplish – create different instances of buddypress with all tables for each site.

    Till now i found out that manipulating with define( ‘BP_ROOT_BLOG’, $blog_id ); (line 16,bp-core) i can make social part avaiable from each site. the problem is that avatars on other sites disappeared and – of course – i’m afraid about google and duplicated content issue.

    My goal is to have on ‘global’ buddypress instance and ‘local’ buddypress instances for each site. The only thing i’m afraid about is number of tables and queries to load each site on such a configuration…

    I’m afraid that many things i changed could be written much more simplier using build in wpmu and buddypress functions so if anybody see such a situation, please write about it here.

    I think i finished enabling buddypress sitewide with same data for each site. Last changes i made were made in core files – can i move them somehow outside to leave core files as they are?

    Change to bp-core.php enabling buddypress dirs on additional sites:

    line 16:

    if ( !defined( 'BP_ROOT_BLOG' ) ) {

    global $current_blog,$wpdb;

    $blog_url = get_blog_option($current_blog->blog_id, 'siteurl' );

    $blog_url_pieces = explode("/", $blog_url);

    $blog_url_pieces = explode(".", $blog_url_pieces[2]);

    if (isset($blog_url_pieces[2]) && $blog_url_pieces[2]!='')

    $blog_url = $blog_url_pieces[1].'.'.$blog_url_pieces[2];

    else

    $blog_url = $blog_url_pieces[0].'.'.$blog_url_pieces[1];

    $query = "SELECT * FROM {$wpdb->blogs} WHERE domain='".$blog_url."'";

    $blog = $wpdb->get_row($query);

    define( 'BP_ROOT_BLOG', $blog->blog_id );

    }

    Change to bp-core-avatars.php solving issue with wrong avatars urls:

    In function bp_core_render_avatar_cropper()

    $src = str_replace( array(ABSPATH), get_blog_option( 1, 'siteurl' ).'/', $new );

    In function bp_core_get_avatar()

    $url =get_blog_option(1, 'siteurl' ) . '/' . $avatar_file;

    avatars – maybe it would be enough to point on route to another via htaccess?

    really noone interested in multi-site possibilities?


    nicholaszen
    Participant

    @nicholaszen

    I am very interested in this topic, but have none to very less programming experience… I wished I could help you out… I am trying this also already this out on localhost…

    How to separate activity for each site:

    – similiar change to bp-core.php as above

    – change in bp-activity.php function bp_activity_setup_globals()

    $bp->activity->table_name_user_activity = $wpdb->base_prefix . BP_ROOT_BLOG . '_' . 'bp_activity_user_activity';

    $bp->activity->table_name_user_activity_cached = $wpdb->base_prefix . BP_ROOT_BLOG . '_' . 'bp_activity_user_activity_cached';

    $bp->activity->table_name_sitewide = $wpdb->base_prefix . BP_ROOT_BLOG . '_' . 'bp_activity_sitewide';

    -i don’t know why, but there was also necessary to comment this lines in bp-activity-classes.php function save() (what, as i suppose, may cause some problems):

    //if ( !$this->item_id || !$this->user_id || $this->is_private || !$this->component_name )

    //return false;

    To divide blogs:

    – described above change to bp-core

    – change in bp-blogs.php bp_blogs_setup_globals function:

    $bp->blogs->table_name = $wpdb->base_prefix . BP_ROOT_BLOG . '_' . 'bp_user_blogs';

    $bp->blogs->table_name_blog_posts = $wpdb->base_prefix . BP_ROOT_BLOG . '_' . 'bp_user_blogs_posts';

    $bp->blogs->table_name_blog_comments = $wpdb->base_prefix . BP_ROOT_BLOG . '_' . 'bp_user_blogs_comments';

    $bp->blogs->table_name_blogmeta = $wpdb->base_prefix . BP_ROOT_BLOG . '_' . 'bp_user_blogs_blogmeta';

    To divide groups: suppose that similiar:

    -…

    – change in bp-groups.php groups_Setup_globals function:

    <br />
    $bp->groups->table_name = $wpdb->base_prefix . BP_ROOT_BLOG . '_' . 'bp_groups';<br />
    $bp->groups->table_name_members = $wpdb->base_prefix . BP_ROOT_BLOG . '_' . 'bp_groups_members';<br />
    $bp->groups->table_name_groupmeta = $wpdb->base_prefix . BP_ROOT_BLOG . '_' . 'bp_groups_groupmeta';<br />

    (not checked)

    Making bp-messages and bp-xprofile sites-ready should be similiar but in my case i will let them be global.

    it seems that there is problem with storing of user activity, any help with coding or testing?


    petronic
    Participant

    @petronic

    Hi.

    I wrote a simple plugin that enables BuddyPress to work with MultiSite. Unfortunately, it requires few changes in BuddyPress core files (adding some actions). Maybe BuddyPress authors will consider adding this actions in some of the future releases.

    The easiest way to have one BuddyPress instance but separate BuddyPress networks on different domains is to create a new set of tables for each site. I not very happy with this solution, but as WPMU creates new sets of tables for each blog, I guess it will be OK to have few sets of BuddyPress tables for each domain (site). And this could improve performance because tables will be smaller and interaction between them is not needed.

    If anyone is interested in BuddyPress working with MultiSite, please contact me.


    Jeff Sayre
    Participant

    @jeffsayre

    @P.S.

    If you have an idea to improve BuddyPress functionality, please submit it to Trac as an “enhancement” ticket. You log into Trac with the same username and password as on this forum.

    https://trac.buddypress.org/newticket


    petronic
    Participant

    @petronic

    Thank you, Jeff.

    I created new ticket.

    https://trac.buddypress.org/ticket/771

    P.S. – me, me! please publish it somewhere..

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘BuddyPress and Multi-Site issues’ is closed to new replies.
Skip to toolbar