Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #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_layerslider

    Is 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!

    #411614

    Hey!

    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,
    Josue

    #412239

    Hello,
    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!

    #412476

    Oh, 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,
    Josue

    #414056

    Hey!

    Thanks for the notice. I will let the layerslider team know, I am not certain if this is intended or a bug but it certainly does not sound right to me to create a database for each installation, even if the layerslider is not used accross the network….

    Regards,
    Kriesi

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.