I am trying to create a plugin which captures the hooks for subscription and transaction changes.

I managed already to add the correct hooks as actions. I am receiving the transaction object and am able to get the according user. When the status of a transaction changes eg. from pending to complete the method $user->is_active() shows that the user is no longer active, which is right.

If i delete a transaction this method returns true which is wrong. When i am switching to the users afterwards the user is no longer active in the list (in dashboard).

It seems like the updates to the user are done after the hook fires.

Is there any way that i can delay the action call to the hook?

I know WordPress offers priorities for hooks but that didn’t work. I somehow need to manage to create something like a Future object. But we are talking about PHP and i don’t want to include an async library like Amp. It seems overkill to me.

Thank you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.