Creating a user from a widget. When debugging the code, the second method fires and not the first. When I create the user from the control panel, the first method seems to fire appropriately.
Creating a user from a widget. When debugging the code, the second method fires and not the first. When I create the user from the control panel, the first method seems to fire appropriately.
Its possible yes that update would fire after a create, especially since processes may update a user subsequently. If you are saying one is firing in lieu of the other, I would need to see how you have it wired up.
The Update is firing instead of the create when called from a widget. When I create the user from the control panel it fires as expected.
I was just using the base $core_v2_user.Create($username, $password, $email) within a widget. When I call this, the AfterUserUpdated fires. When I create a user from control panel, the AfterUserCreated fires as expected.
After fixing up a few more errors, I found that the AfterUserUpdated and AfterUserCreated are both firing when I create a user via that widget extension, only the AfterUserUpdated is firing first...This seems like a bug?
Its possible that a user object is updated at some point during create (possibly to commit profile fields) as it is not a single step process.
From an event handling perspective however you should never rely on a specific ordering of events in code.
I understand that. Just seems strange that the Update event would be called before a Create as you'd assume you can't update anything before a create is called. I'll have to handle this in my code. Thanks Patrick.
I went through the code itself, and I actually do not see a specific inline scenario where after update could be invoked first. So it could be a matter of execution timing, or something else in another event, say an after create that is handled before another create invoking an update. Thats why its hard to rely on any specific timing.
Got it. Thanks Patrick.
Got it. Thanks Patrick.