I noticed that in
nggallery.phpin the function
define_tablesthat table names are cached upon loading the plugin.
// add database pointer
$wpdb->nggpictures = $wpdb->prefix . 'ngg_pictures';
$wpdb->nggallery = $wpdb->prefix . 'ngg_gallery';
$wpdb->nggalbum = $wpdb->prefix . 'ngg_album';
Unfortunately this means almost any attempt to use
switch_to_blog()in a multisite environment won’t work. For instance, on plugin load of site 2 the variables will look like
switch_to_blog(1)never updates these cached variables so queries still assume site 2.
switch_to_blog()calls an action at the end that you can hook into. Any chance of adding support for this? You should be able to add this directly to
nggLoader(I did in my copy).
add_action('switch_blog', array(&$this, define_tables));
- The topic ‘switch_to_blog not supported’ is closed to new replies.