WordPress.org

Ready to get started?Download WordPress

Forums

Nav Menu Roles
[resolved] Fatal error: Cannot redeclare class Nav_Menu_Roles_Import (8 posts)

  1. TJ Kelly
    Member
    Posted 1 year ago #

    Fatal error: Cannot redeclare class Nav_Menu_Roles_Import in /path/to/wordpress/wp-content/plugins/nav-menu-roles/inc/class.Nav_Menu_Roles_Import.php on line 12

    I'm running WP Multisite here. Installed the plugin on my network and activated across all sites. Went to Tools > Import on a network sub-site and got the fatal error above. Can't even select which import method to use, never mind import any XML file.

    Any advice?

    http://wordpress.org/extend/plugins/nav-menu-roles/

  2. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    I would delete the plugin and reinstall it. And be sure that you don't have anything else with a class called Nav_Menu_Roles_Import. While this should be unlikely it is worth checking by disabling plugins reverting to default theme, etc because I cannot reproduce this on my Multisite install. I can probably wrap my class in an if class_exists() wrapper if that will help.

    Try this after you've excluded your theme and other plugins as the possible culprit:
    https://github.com/helgatheviking/nav-menu-roles

  3. TJ Kelly
    Member
    Posted 1 year ago #

    Thank you, reverting to the default theme seemed to work. I no longer get the fatal error.

    One more question. Please forgive me for being a bit off-topic here:

    I read your question/answer on WordPress Answers. If I understand it right, your plugin should import all menu items (plus meta data of those menu items), right? Not just the menus, but each page/link item within each menu?

    I believe I'm using your plugin for a purpose other than its intended one, but my objective is to import 10 menus and their respective items. Can your plugin help me accomplish that? I'm not interested in hiding/showing menu items based on user roles, but if it helps me import a few hundred menu items, I'll happily take it.

  4. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    If reverting to the default theme caused the problem (and you found me on WordPress answers) does that mean you copied my Answer code into your own theme? That would explain why that class was being "re-declared". If so, could you mark this thread as resolved?

    Off-topic: My plugin does not do anything special for exports, but I found that the standard (ALL) export does include menu meta. It was the importer that was ignoring this. My plugin goes back over the import file and updates the meta for all the menu items, so I'm not sure it is exactly what you are looking for.

    You should be able to import your menus through the traditional route. If you look there might even be a plugin that will export just the menus, I don't know.

  5. TJ Kelly
    Member
    Posted 1 year ago #

    Yes, I suppose this one is resolved. But my main question still isn't answered.

    Main question: Assuming my export contains all the necessary data for menus and menu items, will your plugin import my menu items?

    I.e., will it take my menus from looking like this to looking like this?

    That's a big assumption above, I realize. But I've looked through my XML file and it appears to match the code you show in your WP Answers post.

    If you'd prefer, I can open a new support thread. I realize this isn't really *support* per se. Sorry about that.

  6. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    No my plugin will not do that. It doesn't import the items themselves, it only adds all the meta data that the Import plugin skips.

    I am relatively sure that the regular Export ALL, followed by Import will import your menus and would advise you to use that. Note, that you might have empty menus if you are not importing the pages/posts/whatever that the original items referenced.

  7. TJ Kelly
    Member
    Posted 1 year ago #

    Aha. Thank you. I misunderstood the capabilities of the plugin, then. Thank you for clarifying.

    Unfortunately, I've imported the content several times over, guaranteeing that the pages already exist. However, the menu items still don't import. Terribly frustrating.

    Thanks again for your prompt responses.

  8. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    I had to look at the importer plugin when digging into the missing nav menu role meta, so I know that it imports the menu items, but I couldn't tell you what happened on your imports. If you can, you might want to consider the WP Suicide plugin to wipe out everything and try the import again.

    Best of luck.... trust me I feel your pain! I think anyone who works with code at all does. Time for practice now so no more hanging out on the forums! ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.