1 | <?php |
---|
2 | function ra_bp_multinetwork_filter( $prefix ) { |
---|
3 | global $wpdb; |
---|
4 | |
---|
5 | if( $prefix != $wpdb->base_prefix ) |
---|
6 | return $prefix; |
---|
7 | if( $wpdb->siteid > 1 ) |
---|
8 | return $prefix . $wpdb->siteid . '_'; |
---|
9 | |
---|
10 | return $prefix; |
---|
11 | } |
---|
12 | add_filter( 'bp_core_get_table_prefix', 'ra_bp_multinetwork_filter' ); |
---|
13 | |
---|
14 | function ra_bp_multinetwork_meta_key_filter( $key ) { |
---|
15 | global $wpdb; |
---|
16 | |
---|
17 | $active = current_filter(); |
---|
18 | if( $wpdb->siteid > 1 && substr( $active, 0, 3 ) == 'bp_' && substr( $active, 0, strlen( $key ) ) == $key ) |
---|
19 | return substr( $key, 0, 3 ) . $wpdb->siteid . substr( $key, 2 ); |
---|
20 | |
---|
21 | return $key; |
---|
22 | } |
---|
23 | add_filter( 'bp_latest_update_meta_key', 'ra_bp_multinetwork_meta_key_filter' ); |
---|
24 | add_filter( 'bp_favorite_activities_meta_key', 'ra_bp_multinetwork_meta_key_filter' ); |
---|