WordPress.org

Ready to get started?Download WordPress

Forums

Custom Upload Dir
Fatal error: Call to undefined function get_userdata() (5 posts)

  1. Israel Curtis
    Member
    Posted 3 years ago #

    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"...

  2. Israel Curtis
    Member
    Posted 3 years ago #

    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?

  3. Israel Curtis
    Member
    Posted 3 years ago #

    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()

  4. jbh
    Member
    Posted 3 years ago #

    Thank you, for this!

  5. ulfben
    Member
    Plugin Author

    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic