-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed priority of handle_returns and maybe_redirect to fix notification issue. #181
Conversation
I'm not a fan of using
https://developer.wordpress.org/reference/hooks/wp_loaded/ Maybe it is a problem that actually needs to be solved in WPNotif. Is it this plugin: https://wpnotif.unitedover.com/? You mentioned 'WPNotif' and 'WPNotify'. The question might be why isn't this plugin fully loaded when |
Yes, the Plugin name is WPNotif, I miss-typed it to WPNotify at one place. I have corrected it. WPNotif is using default priority (ie 10) for hooking into the wp_loaded action. Here is the code of WPNotif ( from file /wpnotif/includes/functions.php )
I understand, here WPNotif should use plugins_loaded hook instead of wp_loaded hook. Even if they are using the wp_loaded hook, they should be using a lower priority than 10. The client also tried contacting the WPNotif support team, but for other default and third-party payment gateways of WooCommerce, WPNotif is working fine, that's why they are not taking pain to fix their code. Because of this, the client is suffering. I was thinking some other notification plugins might also be doing something similar which might conflict with our code, It would be better if we could increase our priority. If not PHP_INT_MAX, can we increase it a little bit, something like 20? What do you suggest? |
A priority of |
Updated priority to 100 as suggested by @remcotolsma
I have updated the priority to 100 in the PR. |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #181 +/- ##
============================================
- Coverage 21.89% 21.89% -0.01%
Complexity 2530 2530
============================================
Files 107 107
Lines 10380 10382 +2
============================================
Hits 2273 2273
- Misses 8107 8109 +2 ☔ View full report in Codecov by Sentry. |
Some plugins that perform tasks after payment confirmation (Eg WPNotif), get loaded late, because of which notification does not get triggered after payment confirmation if we confirm the payment sooner than they get loaded. So, I have increased the priority of handle_returns and maybe_redirect to max possible value, to make sure, notification plugins or any other dependent plugin gets loaded before payment gets confirmed.
My client reported this issue in which SMS and Whatsapp message was not getting triggered by WPNotif in case of Knit Pay whereas WPNotif was working fine for other payment gateway plugins.