Support » Plugin: WordPress File Upload » plugin throw a php notice

  • Resolved Pexle Chris

    (@pexlechris)


    Your plugin throws a php notice
    Notice: Undefined offset: 5 in /var/www/vhosts/onlymaths.gr/httpdocs/wp-content/plugins/wp-file-upload/lib/wfu_functions.php on line 1509

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author nickboss

    (@nickboss)

    Hi, interesting, when does this happen?

    Regards

    Nickolas

    on every load of wp-admin and when WP_DEBUG mode is true

    Plugin Author nickboss

    (@nickboss)

    Have you made any changes to plugin’s settings? Can you send me a screenshot of Settings?

    Nickolas

    Plugin Author nickboss

    (@nickboss)

    I cannot reproduce your error. Seems that something is not working as expected. Do you have any special scripts in functions.php?

    Nickolas

    yes. I have some custom code.

    Plugin Author nickboss

    (@nickboss)

    Does it create or change any new globals $GLOBALS[“WFU_GLOBALS”] ?

    Nickolas

    Yes I change the $GLOBALS[“WFU_GLOBALS”][‘WFU_UPLOADEDFILES_BARMENU’] in an wp_loaded hook!

    Plugin Author nickboss

    (@nickboss)

    Can you send me the code you used?

    Nickolas

    add_action('wp_loaded', 'remove_wfu_admin_toolbar_new_uploads');
    function remove_wfu_admin_toolbar_new_uploads(){
    	$GLOBALS["WFU_GLOBALS"]['WFU_UPLOADEDFILES_BARMENU']= array( "Uploaded Files Toolbar Menu State", "string", "false", "Defines whether the Uploaded Files Toolbar (Admin Bar) menu item will be shown or not. It can be 'true' or 'false'." );
    }
    Plugin Author nickboss

    (@nickboss)

    Change it like this:

    add_action('wp_loaded', 'remove_wfu_admin_toolbar_new_uploads');
    function remove_wfu_admin_toolbar_new_uploads(){
    	$GLOBALS["WFU_GLOBALS"]['WFU_UPLOADEDFILES_BARMENU']= array( "Uploaded Files Toolbar Menu State", "string", "false", "false", "Defines whether the Uploaded Files Toolbar (Admin Bar) menu item will be shown or not. It can be 'true' or 'false'.", true );
    }

    Any better?

    Nickolas

    Yes it solves the problem.

    What was the problem with this code?

    Plugin Author nickboss

    (@nickboss)

    The variable $GLOBALS[“WFU_GLOBALS”][‘WFU_UPLOADEDFILES_BARMENU’] is an array which should normally have 6 items. In your initial code it was initialized with only 4 items, so when the plugin tried to access item with offset 5 (this is the 6th item) it could not find it and threw a warning.

    Nickolas

    ok, Thanks for the answer

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