Duplicate entry error with New Blog Templates plugin

I'm receiving an error when I try to create a new site using the New Blog Template plugin. It's related to the "Theme My Login" plugin though, so maybe not something you can help me with.

Here's the error:

Insertion Error: Duplicate entry 'theme_my_login' for key 2 - The template was not applied. (New Blog Templates - While inserting templated settings)

  • Mason
    • DEV MAN’s Sidekick

    Hiya pinkpeppercorn,

    Are you trying to copy any database info specific to theme my login in the advanced options of New Blog Templates? I haven't looked into this myself, but we can try to take a look.

    Also, what version of WordPress, and the theme my login and NBT plugins are you running?

    Thanks!

  • Mason
    • DEV MAN’s Sidekick

    Hiya,

    Ok, I attempted this on my own install with the same setup and wasn't able to reproduce this error.

    Do you have the theme my login plugin network activated? Which modules are you running?

    Also, is the NBT plugin using the main site as the template or a sub-site?

    Hopefully we can get to the bottom of this soon. Thanks.

  • pinkpeppercorn
    • WPMU DEV Initiate

    I'm still getting this error.

    I do have Theme my login network activated.

    NBT is using my default theme as the template.

    I can create the store on frontend, but when I click the activate I get an error that Duplicate entry 'theme_my_login' for key 2

    I can PM you login details if you'd like to have a look.

    Here's the list of active network activated plugins:

    Better Related Content <-tried with this disabled
    Collapsing Categories <-tried with this disabled
    MarketPress
    MarketPress Product Grid Shortcode
    New Blog Templates
    Signup TOS
    Theme My Login
    Widget Logic
    WPMS Sidebar Login Widget
    WPMU DEV Update Notifications

  • Mason
    • DEV MAN’s Sidekick

    Ahh, thanks @pinkpeppercorn,

    Let me get the developer to take a look at this with us. I thought we had that one stamped out already.

    One way around it would be to remove the entry from the database of the template site. Then when the plugin is activated during site creation there shouldn't be a duplicate. Obviously that's not a solution for everybody, but should allow you to continue using both plugins for the immediate future.

    Thanks !

  • Giovanni
    • The Incredible Code Injector

    Hello.

    I'm getting the error:

    Insertion Error: Duplicate entry 'theme_my_login' for key 'option_name' - The template was not applied. (New Blog Templates - While inserting templated settings)

    Not key '2'.

    Any ideas on what that is?

    What do you mean by removing the entry from the database of the template site?

    Thanks!

  • 12starsmedia
    • New Recruit

    @masonjames

    We're also getting the same error as @giovanni.

    "Insertion Error: Duplicate entry 'theme_my_login' for key 'option_name' - The template was not applied. (New Blog Templates - While inserting templated settings)"

    Would really appreciate some advice as Theme My Login is currently driving our entire network's login pages.

  • 12starsmedia
    • New Recruit

    @masonjames
    I've attempted your work-around solution, deleting the theme_my_login row from the options table of the template site, but I'm still getting the same error message. It appears that when trying to create the new site, Theme My Login is re-initialized and the entry added back into the database prior to duplication of the template data.

  • Mason
    • DEV MAN’s Sidekick

    Hiya 12starsmedia,

    First up, welcome to WPMU DEV!

    I'm gonna have to ask the developer to assist here and see if we can come up with a solution here. Theme my login must be doing something unique here as other plugins don't have this issue.

    We've added a new area in the plugin to provide for filters for other plugins. You could try going to blogtemplates/blogtemplatesfiles/filters.php and check the pattern to see how we handle similar issues with gravity forms and contact form 7.

    Thanks!

  • 12starsmedia
    • New Recruit

    @masonjames & @pinkpeppercorn

    I added this function to blogtemplates/blogtemplatesfiles/filters.php and it seems to work for me!

    /**
     * Exclude Theme My Login
     **/
    function blog_template_exclude_theme_my_login( $and ) {
    	$and .= " AND <code>option_name</code> NOT IN ('theme_my_login','widget_theme-my-login')";
    	return $and;
    }
    add_filter( 'blog_template_exclude_settings', 'blog_template_exclude_theme_my_login' );
  • Giovanni
    • The Incredible Code Injector

    Unfortunately trying that code I get this error:

    Deletion Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option_name NOT IN ('theme_my_login','widget_theme-my-login') AND `' at line 1 - The template was not applied. (New Blog Templates - While removing auto-generated settings)

  • Mason
    • DEV MAN’s Sidekick

    Hiya HARALAMBOS,

    With each update of 3rd party plugins like Theme my Login, you'll want to make sure the code modifications (such as mentioned here) still work. We can't coordinate with them effectively to make sure nothing changes so it's a bit of a manual process.

    You'll also want to store the additional filters locally as updates to New Blog Templates will remove them. We've tried to make this process easier for folks by creating a specific file to hold the filters (blogtemplates/blogtemplatefiles/filters.php).

    Using this filter should force New Blog Templates to ignore the fact that theme-my-login is installed and allow you to configure it for each individual site. Thanks!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.