Support

Home Forums Event Espresso Premium Hooked in model extension too late!

Hooked in model extension too late!

Posted: April 30, 2024 at 5:48 am

Viewing 2 reply threads


kraker

April 30, 2024 at 5:48 am

We’ve been using a custom plugin built in-house which adds the Ticket scope to the Promotions add-on. It worked fine using older EventEspresso version but we now have to adjust the code to make it work with latest EE version. We are currently getting this error:

Uncaught EE_Error: Hooked in model extension 'EEME_Promotions_Ticket' too late! The model Ticket has already been used! We know because the action AHEE__EEM_Ticket__construct__end has been fired in /public_html/wp-content/plugins/event-espresso-core-reg/core/libraries/plugin_api/db/EEME_Base.lib.php:83
Stack trace:
#0 /public_html/wp-content/plugins/sw-eventespresso-changes/EE4-Promotions-master/db_model_extensions/EEME_Promotions_Ticket.model_ext.php(20): EEME_Base->__construct()
#1 /public_html/wp-content/plugins/event-espresso-core-reg/core/libraries/plugin_api/EE_Register_Model_Extensions.lib.php(109): EEME_Promotions_Ticket->__construct()
#2 /public_html/wp-content/plugins/sw-eventespresso-changes/sw-eventespresso-changes.php(85): EE_Register_Model_Extensions::register('Ticket', Array)
#3 /public_html/wp-inc in /public_html/wp-content/plugins/event-espresso-core-reg/core/libraries/plugin_api/db/EEME_Base.lib.php on line 83

sw-eventespresso-changes is the name of our custom plugin. Here’s how we are registering our scope:

add_action('AHEE__EE_System__load_espresso_addons', 'sw_add_ticket_scope_promotion');
function sw_add_ticket_scope_promotion() {
$register = EE_Register_Promotion_Scope::register("Ticket", [
'scope_path' => '/public_html/wp-content/plugins/sw-eventespresso-changes/EE4-Promotions-master/scopes/EE_Promotion_Ticket_Scope.lib.php',
'model_extension_paths' => array('/public_html/wp-content/plugins/sw-eventespresso-changes/EE4-Promotions-master/db_model_extensions'),
'class_extension_paths' => array('/public_html/wp-content/plugins/sw-eventespresso-changes/EE4-Promotions-master/db_class_extensions')
]);
}

Any suggestions?

Thank you!


Rio

  • Support Staff

May 1, 2024 at 5:51 pm

I can see that problem you submitted is discussed in our tEEM and our developers solution is under testing, Once everything is set, we will update you.

thanks.


kraker

May 8, 2024 at 9:11 am

I’ve managed to get past the errors and it now seems to be working fine. The issue was that my Ticket scope file EE_Promotion_Ticket_Scope.lib.php was missing some (newer) functions. So I’ve copied and adapted all functions from the original eea-promotions plugin (EE_Promotion_Event_Scope.lib.php) onto my EE_Promotion_Ticket_Scope.lib.php.

Basically, my Ticket scope file is a clone of the Event scope file, with naming and queries adjusted accordingly, if it helps anybody.

Thanks.

Viewing 2 reply threads

The support post ‘Hooked in model extension too late!’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso