switch_to_blog not supported
-
I noticed that in
nggallery.php
in the functiondefine_tables
that 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 likewp_2_ngg_pictures
. Callingswitch_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 tonggLoader
(I did in my copy).add_action('switch_blog', array(&$this, define_tables));
https://www.ads-software.com/extend/plugins/nextgen-gallery/
- The topic ‘switch_to_blog not supported’ is closed to new replies.