• Resolved mattorou

    (@mattorou)


    PHP Fatal error:  Uncaught Error: Call to undefined method Tribe__Container::can_be_updated_to() in /wp-content/plugins/event-tickets/src/Tickets/Commerce/Status/Status_Handler.php:121
    Stack trace:
    #0 /wp-content/plugins/event-tickets/src/admin-views/commerce/orders/single/order-actions-metabox.php(15): TEC\Tickets\Commerce\Status\Status_Handler->get_orders_possible_status(Object(WP_Post))
    #1 /wp-content/plugins/event-tickets/common/src/Tribe/Template.php(1062): include('...')
    #2 /wp-content/plugins/event-tickets/common/src/Tribe/Template.php(912): Tribe__Template->template_safe_include(NULL)
    #3 /wp-content/plugins/event-tickets/src/Tickets/Commerce/Admin/Singular_Order_Page.php(181): Tribe__Template->template(Array, Array, true)
    #4 /wp-content/plugins/event-tickets/src/Tickets/Commerce/Admin/Singular_Order_Page.php(248): TEC\Tickets\Commerce\Admin\Singular_Order_Page->template('order-actions-m...', Array)
    #5 /wp-admin/includes/template.php(1456): TEC\Tickets\Commerce\Admin\Singular_Order_Page->render_actions(Object(WP_Post), Array)
    #6 /wp-admin/edit-form-advanced.php(715): do_meta_boxes(Object(WP_Screen), 'side', Object(WP_Post))
    #7 /wp-admin/post-new.php(75): require('...')
    #8 {main}
    thrown in /wp-content/plugins/event-tickets/src/Tickets/Commerce/Status/Status_Handler.php on line 121

    For a website I’m managing, the plugin is triggering a fatal error when attempting to create an order in the wp admin panel at the page wp-admin/post-new.php?post_type=tec_tc_order This doesn’t appear to affect the ability for users on the front-end to create orders. I have redacted some server paths from the log above.

    • Plugin version: 5.18.0.1
    • WordPress Version: 6.7.1
    • PHP Version: 7.4.33 – also tested on 8.1.31

    I have rollled the plugin back as far as version 5.13.3 and can confirm this error begins appearing when using version 5.13.3.1.

    Edit: remvoed link and added the admin slug to the first paragraph.

    • This topic was modified 2 months, 1 week ago by mattorou.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support tristan083

    (@tristan083)

    Hi @mattorou ,

    Thank you for reaching out.

    To help me better understand the situation, would you be able to share the detailed steps (what you’re clicking into in the admin dashboard) to get to the create order screen or a screen recording of it? I ask, as I don’t believe the Event Tickets plugin ships with the ability to create orders from the admin dashboard.

    Thread Starter mattorou

    (@mattorou)

    Thanks for confirming the plugin isn’t supposed to do this!

    We have the PublishPress Capabilities plugin installed which I’ve confirmed to be adding the “Add New Order” button to the edit.php?post_type=tec_tc_order page, in the admin head next to the title. We haven’t enabled any settings in that plugin that would’ve allowed any users to create orders in this manner.

    Is this something I should raise with PublishPress?

    Plugin Support tristan083

    (@tristan083)

    Hi @mattorou ,

    Thank you for your message and the clarification.

    By default, the Event Tickets plugin do not have a “Add New Order” in the Orders and Attendees screen. If this is something that’s been added by a third party plugin, I would recommend reaching out to the plugin support or developer for ways to get the button removed.

    Thread Starter mattorou

    (@mattorou)

    Hi @tristan083, I’m opening this thread again because I’ve found the cause of the problem isn’t with the third party plugin; it’s to do with the way the post type is registered in the Event Tickets plugin.

    I have fixed the problem with the following filter:

    add_filter( 'map_meta_cap', function( $caps, $cap ) {
    if ( $cap === 'edit_tc-orders' || $cap === 'publish_tc-orders' ) {
    $caps[] = 'do_not_allow';
    }

    return $caps;
    }, 10, 2 );

    I have added this to a mu plugin as a patch, but ideally this would be fixed within your plugin as I don’t believe the capability to add posts is correctly removed.

    Plugin Support tristan083

    (@tristan083)

    Hi @mattorou ,

    Thank you for your message and the information.

    I am not sure I understand. The Event Tickets plugin does not ship with the ability for users to create/edit orders by default. Are you saying the plugin should check for user capabilities even if it does not have the functionality for users to create/edit orders?

    Plugin Support Darian

    (@d0153)

    Hi @mattorou

    I hope you’re doing well. I just wanted to touch base and check in with you. It’s been a little while since we’ve heard from you. I was just curious if you had the chance to check the response above.

    Looking forward to your reply.

    Thread Starter mattorou

    (@mattorou)

    Hi @d0153, apologies for the delay in response!

    Yes, I believe it should test for capabilities if the plugin is not supposed to have the functionality for users to create and edit orders. I’ve narrowed the issue down to these arguments passed when the orders post type is registererd:

    // from src/Tickets/Commerce/Order.php plugin version 5.19.0

    'capability_type' => 'order',
    'map_meta_cap' => true,
    'capabilities' => [
    // Meta capabilities.
    'edit_post' => 'edit_post',
    'read_post' => 'read_post',
    'delete_post' => 'delete_post',
    // Primitive capabilities used outside of map_meta_cap().
    'edit_posts' => 'edit_posts',
    'create_posts' => 'edit_tc-orders',
    'edit_others_posts' => 'edit_others_posts',
    'delete_posts' => 'delete_posts',
    'publish_posts' => 'publish_tc-orders', // 'publish_posts',
    'read_private_posts' => 'read_private_posts',
    ],

    But I can’t establish what it is exactly that is allowing the capabilities manager plugin to change this. I was able to create another, more simple, post type passing 'do_not_allow' for all the capabilities values and I didn’t not experience the same behaviour.

    Plugin Support tristan083

    (@tristan083)

    Hi @mattorou ,

    Thank you for your message and the information.

    I have lodged a bug report (below) for our products team to further investigate and resolve this matter.

    Your patience while we continue to improve our product offerings is highly appreciated.

    Internal Bug Ticket Reference: TECTRIA-740

    Plugin Support Darian

    (@d0153)

    Hi @mattorou

    I’m happy to assist if you have any further questions on this topic. Otherwise, I’ll proceed with closing this ticket.

    Rest assured, we’ll keep you updated through this thread as soon as there’s any update or fix.

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