WordPress.org

Support

Support » Plugins and Hacks » WP2Cloud » Error on switch_blog

Error on switch_blog

  • Hi,
    I noticed what may be a bug in the plugin, since the internal ClouSE_table_name is initialized only on plugin startup.

    If another plugin runs switch_blog and needs to gather images from this new blog, the ClouSE_table_name isn’t reflecting the blog we’re actually operating upon after switch.

    That’s the case of one custom plugin we’re using.

    This can be easily fixed add an hook in addhooks():
    add_action('switch_blog', array(&$this, 'update_current_blog'), 10, 2);

    and adding a function to update the internal ClouSE_table_name:

    function update_current_blog ($new_blog, $prev_blog) {
                global $wpdb;
    // in Multisite, it's main blog
                if ($new_blog!=1) {
                    $this->ClouSE_table_name = $wpdb->base_prefix . $new_blog . "_cloud_media_content";
                } else {
                    $this->ClouSE_table_name = $wpdb->base_prefix . "cloud_media_content";
                    }
            }

    http://wordpress.org/plugins/wp2cloud-wordpress-to-cloud/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error on switch_blog’ is closed to new replies.
Skip to toolbar