'; } } public function sby_nag_ignore() { global $current_user; $user_id = $current_user->ID; if ( isset($_GET['sby_nag_ignore']) && '0' == $_GET['sby_nag_ignore'] ) { add_user_meta($user_id, 'sby_ignore_notice', 'true', true); } } /** * Remove non-WPForms notices from WPForms pages. * * @since 1.3.9 */ public function sby_admin_hide_unrelated_notices() { // Bail if we're not on a Sby screen or page. if ( ! sby_is_admin_page() ) { return; } // Extra banned classes and callbacks from third-party plugins. $blacklist = array( 'classes' => array(), 'callbacks' => array( 'sbydb_admin_notice', // 'Database for Sby' plugin. ), ); global $wp_filter; foreach ( array( 'user_admin_notices', 'admin_notices', 'all_admin_notices' ) as $notices_type ) { if ( empty( $wp_filter[ $notices_type ]->callbacks ) || ! is_array( $wp_filter[ $notices_type ]->callbacks ) ) { continue; } foreach ( $wp_filter[ $notices_type ]->callbacks as $priority => $hooks ) { foreach ( $hooks as $name => $arr ) { if ( $arr['function'] instanceof \Closure ) { unset( $wp_filter[ $notices_type ]->callbacks[ $priority ][ $name ] ); continue; } $class = ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) ? strtolower( get_class( $arr['function'][0] ) ) : ''; if ( ! empty( $class ) && strpos( $class, 'sby' ) !== false && ! in_array( $class, $blacklist['classes'], true ) ) { continue; } if ( ! empty( $name ) && ( strpos( $name, 'sby' ) === false || in_array( $class, $blacklist['classes'], true ) || in_array( $name, $blacklist['callbacks'], true ) ) ) { unset( $wp_filter[ $notices_type ]->callbacks[ $priority ][ $name ] ); } } } } } }