WordPress.org

Forums

Duplicate Menu
[resolved] Parse error on activation (11 posts)

  1. araucaria
    Member
    Posted 2 years ago #

    When I activate the plugin it throws an error:
    Parse error: syntax error, unexpected T_FUNCTION in /home/tgc_dev/sptc.the-graphics.net/wp-content/plugins/duplicate-menu/duplicate-menu.php on line 41

    I edited the code to make the creation of the page a separate function:

    // WordPress actions
    if( IS_ADMIN )
    {
        add_action( 'admin_menu', 'duplicate_menu_admin_page' );
    
    }
    function duplicate_menu_admin_page () {
    	add_theme_page( 'Duplicate Menu', 'Duplicate Menu', 'manage_options', 'duplicate-menu', array( 'DuplicateMenu', 'options_screen' ) );
    }

    With that change the plugin seems to work fine. Thanks for this - I've been looking for a way to easily duplicate a menu!

    - Chris

    http://wordpress.org/extend/plugins/duplicate-menu/

  2. Sridhar Katakam
    Member
    Posted 2 years ago #

    Thank you Chris.

    Faced the same issue, came here to report and found your working solution!

  3. webpagedesign
    Member
    Posted 2 years ago #

    Awesome, the fix works!

    This plugin will save me so much time :D

  4. Jonathan Christopher
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for the report/feedback. I'll make sure to make the change for the next release, the way the function is implemented is a PHP 5.3+ feature, sorry about that!

  5. Jonathan Christopher
    Member
    Plugin Author

    Posted 2 years ago #

    Version 0.1.1 solves this issue, thanks again!

  6. morcom
    Member
    Posted 2 years ago #

    Hi Jonathan, great plugin which will come in very handy. My problem is that I get the following error when I use it and it gives a partial copy.
    My menus are quite large as we are an online directory so I presume that may be the timeout problem

    Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\new\wp-includes\plugin.php on line 161

    Not sure that anything can be done about this but thought I'd ask.
    By the way I'm doing this on my local WAMP machine so no host gets upset

    Regards

    Fred Morgan

  7. Jonathan Christopher
    Member
    Plugin Author

    Posted 2 years ago #

    Hey Fred, those must be some huge Menus! It makes sense that you get a partial copy because the plugin periodically saves the Menu it's working with as it's working with it. I'll see what I can do to alter the execution time, but if it's possible for you (and I think it should be in your local environment) you can edit your php.ini file and update the max execution time.

  8. morcom
    Member
    Posted 2 years ago #

    Hi Jonathan, yes it is pretty big and maybe get bigger as the the site expands. It also goes to 2nd, 3rd and 4th sub-menu levels.
    Should have thought about the php.ini file which at local machine is accessible so will try it and let you know.
    Working on local level is fine but problem will come if/when I want to import/export just the menu which I don't believe is possible at the moment. That would be good to get your teeth into.

    Regards and thanks

    Fred

  9. Jonathan Christopher
    Member
    Plugin Author

    Posted 2 years ago #

    Yeah definitely let me know if editing your php.ini works locally. In the meantime there are some things I can do in the plugin programmatically to increase that time limit just for the plugin script execution itself.

    I think you're right, that it's not possible to import/export Menus by themselves, but perhaps that's something this plugin could do in a feature version as well... I'll have that rattle around my brain a little bit!

  10. morcom
    Member
    Posted 2 years ago #

    Update:
    php.ini mainmenu-max_execution_time = 60 fixed my problem.

    Thanks

    Fred

  11. morcom
    Member
    Posted 2 years ago #

    Sorry should have read max_execution_time = 60

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Duplicate Menu
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic