Skip to:
Content
Pages
Categories
Search
Top
Bottom

Segregating for Multisite


  • glyndavidson
    Participant

    @glyndavidson

    I’ve read this article on Segregated X-Profile Fields for Multisite which explains how to “create separate tables for each site, so Extended Profile Fields work independently on the network”.

    Looking at the example code, it only shows how to segregate X-Profile fields.

    Before I go down a path that could lead to much frustration, can anybody tell me if the same is possible with groups?

    Perhaps by adding a few lines of code to the example:

    
    function add_custom_bp_groups_tables($sql) {
    ...
      $sql[] = "CREATE TABLE {$wpdb->prefix}bp_groups (
        // bp_groups table fields would go here
      ) {$charset_collate};";
      return $sql;
    }
    
    add_action( 'bp_init', 'modify_bp_global_groups_tablenames' );
    add_action( 'switch_blog', 'modify_bp_global_groups_tablenames' );
    
    function modify_bp_global_groups_tablenames() {
    	global $bp, $wpdb;
    	$bp->groups->table_name            = $wpdb->prefix . 'bp_groups';
    	$bp->groups->table_name_groupmeta  = $wpdb->prefix . 'bp_groups_groupmeta';
    	$bp->groups->table_name_members    = $wpdb->prefix . 'bp_groups_members';
    }
    

    And, by default, does the member’s loop only query users of the current blog, or does it query users for the entire network?

  • The topic ‘Segregating for Multisite’ is closed to new replies.
Skip to toolbar