fix: repoint notice-dismiss callback to Notification::dismiss (regular_dismiss does not exist)#1
fix: repoint notice-dismiss callback to Notification::dismiss (regular_dismiss does not exist)#1ineagu wants to merge 1 commit into
Conversation
Promotions::load() registered the notice-dismiss AJAX handler against
`ThemeisleSDK\Modules\Notification::regular_dismiss`, a method that does
not exist anywhere in the SDK (the real handler is `Notification::dismiss`,
which the SDK already references for this same action elsewhere).
On a non-Neve site (`themeisle_sdk_promotions_neve_installed !== true`)
the gated branch registers this callback. When the broken callback is
reached as a user dismisses a review/promo notice, WordPress calls it via
WP_Hook (call_user_func_array) and PHP fatals:
Uncaught TypeError: call_user_func_array(): Argument #1 ($callback)
must be a valid callback, class ThemeisleSDK\Modules\Notification
does not have a method "regular_dismiss"
The result is an HTTP 500 / blank admin page on dismiss. This affects
every product bundling the SDK (verified across versions 3.3.x); Neve
sites are spared only because the gate closes before the registration.
Fix: point the callback at the existing `Notification::dismiss`. It is
idempotent with the registration in `Notification::load()` (same static
callback + priority de-dupes in WP_Hook), so behaviour is unchanged on
sites that were never hitting the bug.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@HardeepAsrani I got this by change on my ionutn site from freshrank and I know we sometimes get 1 star reviews from users and I was trying to find a root cause, I replicated & tested the fix, not sure if I am missing anything |
There was a problem hiding this comment.
Pull request overview
This PR fixes a fatal error in the Promotions module by repointing the wp_ajax_themeisle_sdk_dismiss_notice AJAX handler from a non-existent ThemeisleSDK\Modules\Notification::regular_dismiss method to the existing ThemeisleSDK\Modules\Notification::dismiss method, preventing invalid-callback crashes when dismissing SDK notices.
Changes:
- Update the Promotions module’s notice-dismiss AJAX callback to
ThemeisleSDK\Modules\Notification::dismiss.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Closing — opened against the wrong repo. Moved to the canonical repo: Codeinwp/themeisle-sdk-main. |
Problem
Promotions::load()registers the notice-dismiss AJAX handler against a method that does not exist:Notification::regular_dismissis defined nowhere in the SDK (git log -S "function regular_dismiss"is empty across history). The real handler isNotification::dismiss, which the SDK already references for this exact action (e.g. theremove_action( …, [ 'ThemeisleSDK\Modules\Notification', 'dismiss' ] )in theneve-themes-popularbranch).When the broken callback is reached — a user dismissing a review notice (
<product_key>_review_flag) or a promo notice on a non-Neve site — WordPress invokes it throughWP_Hookand PHP fatals:→ HTTP 500 / blank admin page on dismiss.
Why it's intermittent (and portfolio-wide)
otter_review_flag) and FreshRank (freshrank_ai_review_flag).themeisle_sdk_promotions_neve_installed !== truegate closes, so the bad callback is never registered.Notification::dismissdoesn'twp_die()first), which is why many sites never hit it.Fix
One line: point the callback at the existing
Notification::dismiss. It's idempotent with the registration already done inNotification::load()(identical static callback + priority de-duplicates inWP_Hook), so sites that were never hitting the bug see no behavioural change; sites that were fataling now dismiss cleanly.Verified locally against the real
Notificationclass by dispatching the hook exactly asclass-wp-hook.php:341does: with the fix the dismiss succeeds; before it, the verbatim productionTypeErroris raised.🤖 Generated with Claude Code