• Resolved prestroad

    (@prestroad)


    Using WordPress 6.8.1. Using theme 2025. Using USP Free Version 20250329

    Using USP with image upload. Form fill out & image selection work properly with image visible in form. I have it set to return to the same page upon submission. When I submit the form, it processes for a moment after which a word press critical error page comes up. I can back out to the page, and the image is uploaded and the post is created.

    The following error messages are reported in the debug log:

    1. “PHP Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the remove_dashboard_access domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.)”
    2. “[05-Jun-2025 22:07:15 UTC] PHP Fatal error: Uncaught Error: Call to undefined function wp_generate_attachment_metadata()”

    #2 referred to the following file: “…wp-content/plugins/user-submitted-posts/user-submitted-posts.php:1241”

    The critical error does not occur when I submit a post without an image.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Glad to help.

    I am not seeing the error so far, but want to investigate this and try to help resolve any issue. Here is the test that I did:

    1. Install latest WordPress and USP plugin, using Twenty Twenty-Five theme
    2. All plugin settings left at defaults, except enabled the Image field
    3. Submitted a post successfully from the front end

    There were no errors or warnings, everything worked normally.

    So based on that, I am guessing there is some other factor at work in this particular case. Based on the reported error, it sounds like maybe the plugin was not installed completely or correctly for whatever reason. So you may want to try downloading a fresh copy, removing/deleting the current copy, and try starting from scratch with a fresh installation of the plugin.

    Thread Starter prestroad

    (@prestroad)

    Hi Jeff – after re-installing the USP plugin the error persisted. I did a little research on the error – wp_generate_attachment_metadata() – found this:

    Hi Jeff – after re-installing the USP plugin the error persisted. I did a little research on the error – wp_generate_attachment_metadata() – found this: “If this function is undefined in the environment where it is to be used, such as within a Shortcode, use the include function:

    if ( ! function_exists( ‘wp_crop_image’ ) ) {
    include( ABSPATH . ‘wp-admin/includes/image.php’ );
    }

    Since I call USP with a shortcode on a “submit form” page , I added that code to the USP file shortcode-misc.php and it solved the problem. I’m not sure how generalizable this problem and fix is – but it’s now working for me.

    Plugin Author Jeff Starr

    (@specialk)

    Oh good catch, thank you. Already the plugin includes image.php and other necessary files when media_handle_upload function is not available. I will just expand that to include the case where wp_crop_image is not found. Should take care of it.

    PS the display-form shortcode works fine without any extra code when running on default WordPress. So I am guessing there is something else at play here that is preventing the image-crop function from being included/found. Just fyi.

    In any case, thanks for the report. Will get this fixed up for the next plugin update.

    Plugin Author Jeff Starr

    (@specialk)

    @prestroad Just to follow up with this, the described fix is added in the upcoming version of the plugin (v20251121), should be available later today. Please let me know if any further issues, thank you.

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.