Skip to:
Content
Pages
Categories
Search
Top
Bottom

Force all BP pages to a secondary site in BP multi-network?


  • gastronimo
    Participant

    @gastronimo

    WP 4.6.1
    BP 2.6.2
    BP Multi Network 0.1.1

    Does anyone know how to force all BP pages to a secondary site/subdomain within each BP network?? like in:

    Multiple BuddyPress Social Networks

    Supposedly, I have to define the desired BP $site_id for each network_id within a mu-plugin.

    So far, I got this from https://codex.buddypress.org/getting-started/customizing/changing-internal-configuration-settings/
    But, I know its incomplete, so what is missing here?:

    <?php
    /* Set which site ID BuddyPress will run on in each network:  
     * https://make.wordpress.org/core/tag/4-6+dev-notes/page/2/
    */
    
    function pl_bp_network_site_filter
          global $wpdb;
    	
        	if ( $wpdb->siteid = 1 || define ( 'BP_ROOT_BLOG', $site_id ) );
    	// Define this function for sharing BP throughout/across the sites of this network
    	//define ( ‘BP_ENABLE_MULTIBLOG’, true );
    	
    	if ( $wpdb->siteid = 2 || define ( 'BP_ROOT_BLOG', $site_id );
    	// Define this function for sharing BP throughout/across the sites of this network
    	//define ( ‘BP_ENABLE_MULTIBLOG’, true );
    	
    	if ( $wpdb->siteid = 3 || define ( 'BP_ROOT_BLOG', $site_id );
            // Define this function for sharing BP throughout/across the sites of this network
    	//define ( ‘BP_ENABLE_MULTIBLOG’, true );
    
    add_filter( 'bp_get_root_site_id', 'filter_root_site_id' ); // return site ID integer
    
    	}
    }
    
    /**
     * Call when the plugin is activated
     */
    register_activation_hook(__FILE__, 'define-BP-root');

    Anyone else looking for the same solution?

Viewing 1 replies (of 1 total)

  • gastronimo
    Participant

    @gastronimo

    Anyone have an idea how to define the BP root blog for each BP network? Or can point me in the right direction, since the above example was just a poorly educated guess!

    ======================
    Ron

    (2nd site of the Main Networks by adding “define( ‘BP_ROOT_BLOG’, 2 );” to the root wp-config.php )

    That’s your problem. You’ll have to write a mu-plugins plugin to define that value for each network. You’re forcing the second network to use blog 2 as the BP home site. Give the plugin a name like aaa-something.php.
    ==============================

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar