| @@ -37,8 +37,10 @@ | ||
| 37 | 37 | 9999, |
| 38 | 38 | 3 |
| 39 | 39 | ); |
| 40 | 40 | } |
| 41 | + // YITH Plugin Framework panels rendered on WP list pages. | |
| 42 | + add_action( 'in_admin_header', [$this, 'reorder_notice_wrapper_for_yith_panel'], 0 ); | |
| 41 | 43 | // All Fluent Plugin Assets Supports |
| 42 | 44 | $this->whitelist_assets_in_fluent_plugins(); |
| 43 | 45 | } |
| 44 | 46 | |
| @@ -88,8 +90,62 @@ | ||
| 88 | 90 | if ( !empty( $current_screen ) && ($current_screen->id === 'toplevel_page_gf_edit_forms' || $current_screen->id === 'forms_page_gf_new_form') ) { |
| 89 | 91 | return $footer_text . '</div>'; |
| 90 | 92 | } |
| 91 | 93 | return $footer_text; |
| 94 | + } | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * YITH Plugin Framework panel pages (YITH WooCommerce Multi Vendor, Booking, | |
| 98 | + * Membership, ... — anything using plugin-fw) render blank while the | |
| 99 | + * "Hide Admin Notices" option is on. | |
| 100 | + * | |
| 101 | + * YIT_Plugin_Panel::print_panel_tabs_in_wp_pages() hooks all_admin_notices at | |
| 102 | + * priority 10 and opens page wrapper <div>s on purpose — they stay open until | |
| 103 | + * admin_footer. Adminify closes its own .adminify-notices-wrapper on | |
| 104 | + * all_admin_notices at priority 99999999, so that </div> lands inside YITH's | |
| 105 | + * markup and closes YITH's .wrap instead. The notice wrapper then never closes | |
| 106 | + * and swallows the rest of the page, which Adminify hides through | |
| 107 | + * `.adminify-notices-wrapper > *:not(...) { display: none !important; }`. | |
| 108 | + * | |
| 109 | + * Fix: close the notice wrapper before YITH opens its own markup, so both | |
| 110 | + * outputs stay balanced. Notices printed after that point are not wrapped, | |
| 111 | + * which costs nothing here — plugin-fw moves every notice into its own | |
| 112 | + * #yith-plugin-fw__panel__notices box with JS on these screens anyway. | |
| 113 | + * | |
| 114 | + * @return void | |
| 115 | + */ | |
| 116 | + public function reorder_notice_wrapper_for_yith_panel() { | |
| 117 | + global $wp_filter; | |
| 118 | + if ( empty( $wp_filter['all_admin_notices'] ) || empty( $wp_filter['all_admin_notices']->callbacks ) ) { | |
| 119 | + return; | |
| 120 | + } | |
| 121 | + $hooked_callbacks = $wp_filter['all_admin_notices']->callbacks; | |
| 122 | + // Priority YITH opens its unclosed page wrapper at, if it does at all. | |
| 123 | + $yith_priority = null; | |
| 124 | + foreach ( $hooked_callbacks as $priority => $callbacks ) { | |
| 125 | + foreach ( $callbacks as $callback ) { | |
| 126 | + if ( is_array( $callback['function'] ) && isset( $callback['function'][1] ) && 'print_panel_tabs_in_wp_pages' === $callback['function'][1] ) { | |
| 127 | + $yith_priority = (int) $priority; | |
| 128 | + break 2; | |
| 129 | + } | |
| 130 | + } | |
| 131 | + } | |
| 132 | + // No YITH panel on this screen, or no room left to close before it. | |
| 133 | + if ( null === $yith_priority || $yith_priority < 1 ) { | |
| 134 | + return; | |
| 135 | + } | |
| 136 | + // Move Adminify's notice wrapper closer ahead of YITH's opening markup. | |
| 137 | + foreach ( $hooked_callbacks as $priority => $callbacks ) { | |
| 138 | + if ( (int) $priority <= $yith_priority ) { | |
| 139 | + continue; | |
| 140 | + } | |
| 141 | + foreach ( $callbacks as $callback ) { | |
| 142 | + if ( is_array( $callback['function'] ) && isset( $callback['function'][1] ) && 'finish_notice_capture' === $callback['function'][1] ) { | |
| 143 | + remove_action( 'all_admin_notices', $callback['function'], $priority ); | |
| 144 | + add_action( 'all_admin_notices', $callback['function'], $yith_priority - 1 ); | |
| 145 | + } | |
| 146 | + } | |
| 147 | + } | |
| 92 | 148 | } |
| 93 | 149 | |
| 94 | 150 | public function plugin_conflicts() { |
| 95 | 151 | $adminify_ui = AdminSettings::get_instance()->get( 'admin_ui' ); |