Debug Bar plugin – Admin Bar not displaying correctly, unable to turn off debugging

Home Forums BulletProof Security Free Debug Bar plugin – Admin Bar not displaying correctly, unable to turn off debugging

Tagged: , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #14598
    ezekielmudd
    Participant

    Howdy!

    Whenever I visit the BPS Security Admin page I see debugging information displayed at the top of the screen. I would like to shut it off but I cannot remember how I turned it on in the first place. I feel so old!

    It looks like this:

    + – ×
    piston
    5.3.10-1ubuntu3.10
    5.5.35
    Memory Usage
    115,367,704 bytes
    Debug_Bar_Object_Cache
    Object Cache
    Cache Hits: 1763
    Cache Misses: 130
    Group: options - ( 530.08k )
    Group: default - ( 0.03k )
    Group: terms - ( 11.20k )
    Group: nav_menu - ( 1.60k )
    Group: themes - ( 4.09k )
    Group: users - ( 0.40k )
    Group: userlogins - ( 0.03k )
    Group: useremail - ( 0.04k )
    Group: userslugs - ( 0.03k )
    Group: user_meta - ( 11.36k )
    Group: category - ( 3.52k )
    Group: posts - ( 55.67k )
    Group: counts - ( 0.16k )
    Group: plugins - ( 36.14k )
    Group: post_meta - ( 8.83k )

    Does anyone recognize this?
    Does anyone have any suggestions on how to disable it?
    Thank you kindly!

    #14601
    AITpro Admin
    Keymaster

    BPS has a function that prevents other plugins from loading their js and css scripts on BPS pages since this can break BPS menus, functionality and visual display/UI.  We have tested the Debug Bar plugin and it does not cause any issues for BPS plugin pages or break functionality so we will make a permanent change to BPS .50.2 code to whitelist the Debug Bar css and js scripts on BPS plugin pages so that Debug Bar displays correctly, which will show the +, – and X Admin Bar buttons correctly and allow you to turn on/off debugging normally when on BPS plugin pages.

    If you would like to make that code modification now this code is what needs to be modified.

    File:  /wp-content/plugins/bulletproof-security/admin/includes/admin.php
    Code Line:  163 – 193
    Modification: Add , ‘debug-bar’ in the $script_handles array and the $style_handles array (2 places) as shown below highlighted in Yellow.

    // dequeue any rogue plugin or theme scripts & styles from loading in BPS pages and breaking stuff
    function bpsPro_kill_rogue_plugin_theme_scripts_styles() {
    global $wp_scripts, $wp_styles;
    
    	$script_handles = array( 'bps-js', 'admin-bar', 'jquery', 'jquery-ui-core', 'jquery-ui-tabs', 'jquery-ui-dialog', 'jquery-form', 'jquery-ui-accordion', 'jquery-effects-core', 'jquery-effects-blind', 'jquery-effects-explode', 'common', 'utils', 'svg-painter', 'wp-auth-check', 'debug-bar' );
    
    	$style_handles = array( 'bps-css', 'bps-css-38', 'admin-bar', 'colors', 'ie', 'wp-auth-check', 'debug-bar' );
    
    	if ( preg_match( '/page=bulletproof-security/', $_SERVER['REQUEST_URI'], $matches) ) {		
    
    		foreach( $wp_scripts->queue as $handle ) {
    
    			if ( !in_array( $handle, $script_handles ) ) {
    				wp_dequeue_script( $handle );
            		// uncomment line below to see all the script handles that are being blocked on BPS plugin pages
    				//echo $handle . ' | ';
    			}
    		}
    
    		foreach( $wp_styles->queue as $handle ) {
    
    			if ( !in_array( $handle, $style_handles ) ) {
    				wp_dequeue_style( $handle );
    				// uncomment line below to see all the style handles that are being blocked on BPS plugin pages
    				//echo $handle . ' | ';
    			}	
    		}
    	}
    }
    
    add_action( 'admin_enqueue_scripts', 'bpsPro_kill_rogue_plugin_theme_scripts_styles' );
    #14649
    ezekielmudd
    Participant

    That works. Excellent!

    Thank you very much!

    #14651
    AITpro Admin
    Keymaster

    Great! Thanks for confirming that works.  This will be standard new code in BPS .50.2 and all future BPS version releases.  We definitely do not want to block such a cool plugin like Debug Bar and it is of course loading its js and css scripts responsibly on BPS plugin pages. 😉

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.