• After configuring, and making sure I’m working with a saved post, when I attempt to upload an image as an attachment, I get this in the media upload lightbox:

    Fatal error: Call to undefined function get_userdata() in ../wp-content/plugins/custom-upload-dir/custom_upload_dir.php on line 117

    I use that same function myself in my other plugins, so I’m not sure how it’s “undefined”…

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Israel Curtis

    (@somatic)

    the only hint I’m finding is that the function get_userdata() is defined in WP’s pluggables.php, and that some plugin authors have included it manually:

    if (is_admin()) require_once(ABSPATH . 'wp-includes/pluggable.php');

    I just added this line to the top of your plugin, and it worked fine after that…

    How is it working for anyone else without this manual inclusion?

    Thread Starter Israel Curtis

    (@somatic)

    I’m also thinking that the lack of pluggable.php has to do with the fact that the media upload overlay panel is actually an thickbox iframe. As the iframe is only loading the necessary media upload php files, maybe pluggable.php is not being included, and thus no get_userdata()

    Thank you, for this!

    Plugin Author ulfben

    (@ulfben)

    Thank you Somatic! I’ve commited your fix as version 3.0.1. It’ll be available within 15 minutes.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Custom Upload Dir] Fatal error: Call to undefined function get_userdata()’ is closed to new replies.