WordPress.org

Make WordPress Core

Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#23338 closed defect (bug) (invalid)

Notice with a Plugin. Is it a Plugin problem or WordPress problem?

Reported by: j.conti Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Network Admin Keywords:
Focuses: multisite Cc:

Description

Hi,

I activated WP_DEBUG in a WordPress Multisite 3.5.1 and WangGuard show a NOTICE in the Network Dashboard.

The NOTICE is:

Notice: Undefined index: dashboard in /wp-content/plugins/wangguard/wangguard-admin.php on line 2835

http://plugins.trac.wordpress.org/browser/wangguard/tags/1.5.3/wangguard-admin.php#L2835

Ok,

In the plugin, you can find the function:

function wangguard_dashboard_stats() {
	if ( !is_super_admin() )
		return false;

	
	wp_enqueue_script("jquery");
	wp_enqueue_script("jquery-ui-widget");
	wp_enqueue_script("raphael" , "/" . PLUGINDIR . '/wangguard/js/raphael-min.js' , array('jquery-ui-widget'));
	wp_enqueue_script("globalize" , "/" . PLUGINDIR . '/wangguard/js/globalize.min.js' , array('jquery-ui-widget' , 'raphael'));
	wp_enqueue_script("wijmo-wijraphael" , "/" . PLUGINDIR . '/wangguard/js/jquery.wijmo.raphael.min.js' , array('raphael' , 'jquery'));
	wp_enqueue_script("wijmo-wijchartcore" , "/" . PLUGINDIR . '/wangguard/js/jquery.wijmo.wijchartcore.min.js' , array('raphael' , 'wijmo-wijraphael'));
	wp_enqueue_script("wijmo.wijbarchart" , "/" . PLUGINDIR . '/wangguard/js/jquery.wijmo.wijbarchart.min.js' , array('wijmo-wijchartcore'));
	wp_enqueue_script("wangguard-admin" , "/" . PLUGINDIR . '/wangguard/js/wangguard-admin.js');
	
	wp_add_dashboard_widget("wangguard_dashboard_stats", __( 'WangGuard Stats' , 'wangguard' ) . " - " . __( 'Last 7 days' , 'wangguard' ) , "wangguard_dashboard_stats_render");
	
	
	global $wp_meta_boxes;
	

	if (is_array($wp_meta_boxes['dashboard']['normal']['core'])) {
		$normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
		$wangguard_stats_backup = $normal_dashboard['wangguard_dashboard_stats'];

		unset($wp_meta_boxes['dashboard']['normal']['core']['wangguard_dashboard_stats']);
		$wp_meta_boxes['dashboard']['side']['core']['wangguard_dashboard_stats'] = $wangguard_stats_backup;		
	}
	else if (is_array($wp_meta_boxes['dashboard-network']['normal']['core'])) {
		$normal_dashboard = $wp_meta_boxes['dashboard-network']['normal']['core'];
		$wangguard_stats_backup = $normal_dashboard['wangguard_dashboard_stats'];

		unset($wp_meta_boxes['dashboard-network']['normal']['core']['wangguard_dashboard_stats']);
		$wp_meta_boxes['dashboard-network']['side']['core']['wangguard_dashboard_stats'] = $wangguard_stats_backup;		
	}
	
}

it seems that the problematic line is:

$normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];

That's a standar line....

Is the notice a WangGuard Code bug or a WordPress bug?

Not sure, I'm the WangGuard Developer.

Thank you

Change History (2)

comment:1 helen15 months ago

  • Keywords dev-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

The correct place for help/support is the forums.

Also, that's not a standard line. The correct functions to use are add_meta_box() and remove_meta_box(), not manipulating the array directly.

comment:2 j.conti15 months ago

Ok than you.

I always use the forums, but I had the doubt with this problem.

Thank you again.

Note: See TracTickets for help on using tickets.