PHP Fatal Error when user tries to edit front end form

Support MB Frontend Submission PHP Fatal Error when user tries to edit front end form

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #50120
    Tanja KropfTanja Kropf
    Participant

    I have directory and event listing CPTs where users are able to edit. It's worked totally fine, and now it's not. When I'm in admin, I'm redirected to the edit form. When I'm in another role, merchant or contributor, which both have editing capabilities, it redirects to the home page. In debug mode I get a php fatal error:

    PHP Fatal Uncaught TypeError: MBFS\Helper::get_post_content(): Argument #1 ($post) must be of type WP_Post, null given, called
    Stack trace:
    #0 /wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/src/Dashboard/Renderer.php(186): MBFS\Helper::get_post_content()
    #1 /wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/src/Dashboard/Renderer.php(174): MBFS\Dashboard\Renderer->get_edit_page_attrs_from_shortcode()
    #2 /wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/src/Dashboard/Renderer.php(21): MBFS\Dashboard\Renderer->get_edit_page_attrs()
    #3 /wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/src/Dashboard/Shortcode.php(18): MBFS\Dashboard\Renderer->render()
    #4 /wp-includes/shortcodes.php(434): MBFS\Dashboard\Shortcode->shortcode()
    #5 internal function: do_shortcode_tag()
    #6 /wp-includes/shortcodes.php(273): preg_replace_callback()
    #7 /wp-includes/class-wp-hook.php(341): do_shortcode()
    #8 /wp-includes/plugin.php(205): WP_Hook->apply_filters()
    #9 /wp-includes/post-template.php(256): apply_filters()
    #10 /wp-content/themes/bricks/template-parts/page.php(11): the_content()
    #11 /wp-includes/template.php(816): require('/home/vpbyzrt/p...')
    #12 /wp-includes/template.php(749): load_template()
    #13 /wp-includes/general-template.php(206): locate_template()
    #14 /wp-content/themes/bricks/page.php(12): get_template_part()
    #15 /wp-includes/template-loader.php(132): include('/home/vpbyzrt/p...')
    #16 /wp-blog-header.php(19): require_once('/home/vpbyzrt/p...')
    #17 /index.php(17): require('/home/vpbyzrt/p...')
    #18 {main} thrown in /wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/src/Helper.php on line 12
    Plugin: Meta Box AIO
    File: /wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/src/Dashboard/Renderer.php on line 186 and defined
    Line:

    #50121
    PeterPeter
    Moderator

    Hello Tanja,

    Thanks for reaching out.

    Does the merchant or contributor user have their own post in the dashboard to edit? I'm not able to reproduce the issue on my demo site. To prevent the fatal error from occurring, you can use the condition code below in the function get_post_content()
    file wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/src/Dashboard/Renderer.php(186)

    
    	public static function get_post_content( WP_Post $post ): string {
            if ( ! $post ) {
                return '';
            }
            $content = $post->post_content;
    
    #50122
    Tanja KropfTanja Kropf
    Participant

    yes, they have their own post to edit.I'm confused by your solution suggestion and where to put that?

    #50124
    PeterPeter
    Moderator

    Hello,

    You can share your site credentials by submitting this contact form https://metabox.io/contact/
    I will help you fix the error message.

    Thanks.

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