Multi db and MuTags0.2b

Hi.

I had used the MuTags0.2b plugin and then made the Multi db change.

Although I defined the additional wp_global_tags tags the MuTags didn’t work.

This is the solution I found in case some of you have the same problem.

You have to do the following changes:

1. File wp-includes/wp-db.php, in order to add the global_tags table as a table located into the main database

Change the Line ~216

if( $this->blogs != ” && preg_match(“/(” . $this->blogs . “|” . $this->users . “|” . $this->usermeta . “|” . $this->site . “|” . $this->sitemeta . “|” . $this->sitecategories . “:wink:disappointed:i”,$query) ) {

with

if( $this->blogs != ” && preg_match(“/(” . $this->blogs . “|” . $this->users . “|” . $this->usermeta . “|” . $this->site . “|” . $this->global_tags . “|” . $this->sitemeta . “|” . $this->sitecategories . “:wink:disappointed:i”,$query) ) {

2. File /wp-content/mu-plugins/MuTags.php

~ ln 484 change the function mu_query with this:

function mu_query($blog_id, $term_id, $post_date, $post_ID, $taxonomy) {

global $wpdb;

$sql_query =$wpdb->get_results(“INSERT IGNORE INTO $this->dbtable

(tag_id, blog_id, post_id, post_date, taxonomy)

VALUES

(‘$term_id’, ‘$blog_id’, ‘$post_ID’, ‘$post_date’, ‘$taxonomy’:wink::wink:;

return $sql_query;

}

3. Same File /wp-content/mu-plugins/MuTags.php

ln 501 change the function mu_delete_post with this:

function mu_delete_post($post_ID) {

global $blog_id;

global $wpdb;

$post_type = get_post_field(‘post_type’, $post_ID);

$post_status = get_post_field(‘post_status’, $post_ID);

if ($post_type = ‘post’:wink: {

$sql_query = $wpdb->get_results(“DELETE FROM $this->dbtable

WHERE post_id = $post_ID

AND blog_id = $blog_id”:wink:;

}

}

4. Same File /wp-content/mu-plugins/MuTags.php

ln 739 -752 on function ImportWptags

Changes these lines with the following

if($type == ‘tags’:wink: {

$delete = $wpdb->get_results(“DELETE FROM $this->dbtable WHERE taxonomy <> ‘1’”:wink:;

$taxonomy = “post_tag”;

$taxonomyid = “0”;

}

if($type == ‘cats’:wink: {

$delete = $wpdb->get_results(“DELETE FROM $this->dbtable WHERE taxonomy <> ‘0’”:wink:;

$taxonomy = “category”;

$taxonomyid = “1”;

}

5. If you still get errors or no results, you should also comment the line 766 die(‘There was an error’:wink:;

Hope this is helpful to someone.

Cheers

Lena