Event Listener not working in v8 anymore

Permalink
Hi,

I have developed a package which registers the user on external plattforms (such as Wordpress, Typo3, etc.) when he registers on Concrete5. For this purpose I hooked into the on_user_add and on_user_validate event and it worked like a charm in v7. I had placed both listeners to the on_start function in my controller as follows (as shown in the documentation herehttps://documentation.concrete5.org/developers/application-events/ho...

public function on_start() 
    {
        Events::addListener('on_user_add', function($event) {
            // here starts the code where the user is added in external databases
        });
        Events::addListener('on_user_validate', function($event) {
           // here is the code when the user status is updated in external databases
        });
   }


After updating the system to v8 this does not work anymore. The registration process leads to a kind of endless loop. The only event which is fired is on_attributes_saved. I cannot hook into on_user_add and on_user_validate anymore. The registration process ends (after a long loading time, sometimes with browser freeze) with the message that an account with the given values still exists, even though it should not. After inspecting the database I see that the user was inserted, but does not appear in the dashboard.

Has there something changed in v8 in the handling of events and hooking into respectively?

This is weird.

Hope that someone can help.

All the best, Paolo

 
Gondwana replied on at Permalink Reply
Gondwana
I think they might have resequenced the order in which some controller events are called compared to when c5 does some of its own initialisation. Scour github for clues.
OKDnet replied on at Permalink Reply
OKDnet
I would post this on the Slack Channel for Package Development
https://concrete5.slack.com/messages/C2N2WS3QX...

You'll definitely get an informed response quicker there.
pamentz replied on at Permalink Reply
I had to register a new account as when I logged in there appeared a message that the account is inactive. So here my reply with the new account:

Thanks for your answers.

@OKDnet

How can I do this? Seems that only registered members can do this (and view the provided link) with an email adress ending on the domains @concretecms or @portlandlabs.
pamentz replied on at Permalink Reply
@OKDnet
Found the channel and posted the problem there. Thank you.
OKDnet replied on at Permalink Reply
OKDnet
NP, hopefully it will help you get an answer, because changes like this can be frustrating when there's no documentation.
thebogdan replied on at Permalink Reply
thebogdan
I'm about to start development of a new project that was going to rely on event listener.

Has this issue been solved? Is event listener working in 8.3?
mnakalay replied on at Permalink Reply
mnakalay
I am using events in several packages and it works. I have been using page-related events, and blocks related events and they work pretty well.

I also used events with the Comunity Store package which dispatches its own events and that works too.