-
AuthorPosts
-
March 13, 2015 at 7:14 pm #411230
Hello,
We installed the theme on a multisite for testing and noticed it created a “_layerslider” table for each site on the network, even though the theme was NOT network enabled. The multisite has 8 sites and it was only activated on one site (site #7). After checking the database tables, we see one new table for each site. The table for site for #7 has two records in it, which are the sample settings. The tables for the other sites don’t have any records, but it still created the table for each site.wp_layerslider
wp_2_layerslider
…
wp_7_layersliderIs there a reason why these tables were created on sites where the theme was not enabled?
For our case, we will not network enable the theme and not every site will use it. Are there any specific database related items related to multisite installations?
Thank you!
March 15, 2015 at 1:08 am #411614Hey!
I believe this occurred because as LayerSlider is bundled with Enfold when the theme got network-activated it created those LS tables for all sites, here’s what i’d suggest:
1. Network disable Enfold
2. Manually remove unnecessary LS tables
3. Enable Enfold only for the site who will use it – http://interwebworld.co.uk/2013/09/29/wordpress-multisite-enable-theme-single-site/Best regards,
JosueMarch 16, 2015 at 3:53 pm #412239Hello,
You said “I believe this occurred because as LayerSlider is bundled with Enfold when the theme got network-activated it created those LS tables for all sites”I said in my question that the theme was NOT network activated. I made sure of that. Even so, creating tables should be done the first time the theme Activated through Appearance | Themes and not when it is network enabled. Maybe the after_switch_theme hook will do. That way it will only process that function when needed. Network Enabling a theme does not mean it is in use.
After further research, the function layerslider_activation_scripts() on line 17 in activation.php specifically loops through each site and creates the new table. See lines 28-35:
// Get all sites
$sites = $wpdb->get_col(“SELECT blog_id FROM $wpdb->blogs”);// Iterate over the sites
foreach($sites as $site) {
switch_to_blog($site);
layerslider_create_db_table();
}This function gets kicked off when a theme is activated on a site like I suggested above. However, it runs this loop if it is multisite. The way it is written, I imagine it will get fired off each time the theme is activated on a new site. Can’t you just run the layerslider_create_db_table() function on the site the theme is activated on and omit this loop altogether?
Thanks for your help!
March 16, 2015 at 7:40 pm #412476Oh, sorry i didn’t note that in your first message so i thought that caused the issue, anyhow thanks for noticing the real culprit, not sure if we can change it though as LS is a third-party plugin that gets bundled with the theme as it is, but i’ll let Kriesi know.
Regards,
JosueMarch 19, 2015 at 12:34 am #414056 -
AuthorPosts
- You must be logged in to reply to this topic.