We are having a website for monitoring performance of client’s website, We are using Business Intelligence wordpress plugin for displaying the client about the performance. While a new client logging in for first time and selects his dashboard we are getting the following error and when we update in database the error vanishes but first time the dashboard should display custom message.
I am using the following sql query
select lastsamplestatus,lasterrorat,avguptimeday,status from
selenium_script_data as ssd inner join selenium_scripts as ss
on ss.script_id=ssd.selenium_id inner join wp_users as wu on
wu.ID=ss.customer_id where wu.ID={{{user_ID}
Notice: Undefined variable: label_x in /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php on line 405
Notice: Undefined variable: data in /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php on line 417
Warning: Invalid argument supplied for foreach() in /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php on line 417
Notice: Trying to get property of non-object in /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/resources/nvd3/wrappers/nvd3_lineChart.php on line 60
Notice: Undefined variable: ds in /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/resources/nvd3/wrappers/nvd3_lineChart.php on line 154
Notice: Trying to get property of non-object in /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/resources/nvd3/wrappers/nvd3_lineChart.php on line 154
Notice: Undefined variable: table in /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php on line 158
Notice: Trying to get property of non-object in /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php on line 158
We want to display a normal custom message for the user until admin updates database, I don’t know where to customize functions.php, I got this file from Business Intelligence plugin for wordpress.
I have pasted a part of code below, any help will be appreciated.
//Assign values and labels
switch($wpbi_chart->type){
case chart::DONUT:
case chart::PIE: if(sizeof($label_x) > 0){
$wpbi_chart -> set_x_axis_labels($label_x,
$vo_chart->chart_x_labels_size,
$vo_chart->chart_x_labels_color);
}
foreach($data as $key => $value){
//Overwrite data value for pie chart in order to show labels (via pie_value object)
if(sizeof($label_x)>0){
for($idx = 0; $idx < sizeof($value); $idx++){
$value[$idx] = new pie_value($value[$idx], $label_x[$idx]);
}
}
$wpbi_chart -> set_tooltip($wpbi_dialog['charts']['pie']['tooltip']);
$wpbi_chart -> create_element($key, $value);
$wpbi_chart -> elements[$key] -> set_colours($wpbi_settings['pie-chart']['color-set']);
}
break;
case chart::BAR_STACKED: if(sizeof($label_x) > 0){
$wpbi_chart -> set_x_axis_labels($label_x,
$_POST[$wpbi_settings['parameter']['ch-x-label-size']],
$_POST[$wpbi_settings['parameter']['ch-x-label-color']]);
$wpbi_chart->x_axis_istime = (sizeof($istime_cols) > 0);
if($wpbi_chart->x_axis_istime){
$wpbi_chart->x_axis_labels->labels = $wpbi_chart->convert_to_time($wpbi_chart->x_axis_labels->labels);
}
}
$wpbi_chart-> set_y_axis_labels_color($_POST[$wpbi_settings['parameter']['ch-y-label-color']]);
$wpbi_chart-> set_y_axis_labels_size($_POST[$wpbi_settings['parameter']['ch-y-label-size']]);
foreach($data_stacked as $key => $value){
$wpbi_chart -> create_element('BAR_STACKED', $value);
$wpbi_chart -> elements['BAR_STACKED'] -> set_colours($stacked_label_color);
}
break;
case chart::STACKED_AREA:
case chart::LINE_AREA: if(sizeof($label_x) > 0){
$wpbi_chart -> set_x_axis_labels($label_x,
$vo_chart->chart_x_labels_size,
$vo_chart->chart_x_labels_color);
}
$wpbi_chart-> set_y_axis_labels_color($vo_chart->chart_y_labels_color);
$wpbi_chart-> set_y_axis_labels_size($vo_chart->chart_y_labels_size);
foreach($data as $key => $value){
$wpbi_chart -> create_element($key, $value);
$wpbi_chart -> elements[$key] -> set_colour($label_color[$key]);
$wpbi_chart -> elements[$key] -> set_fill_colour($label_color[$key]);
$wpbi_chart -> elements[$key] -> set_fill_alpha( 0.5 );
}
break;
case chart::RADAR: if(sizeof($label_x) > 0){
$wpbi_chart -> set_y_axis_labels($label_x,
$vo_chart->chart_y_labels_size,
$vo_chart->chart_y_labels_color);
}
foreach($data as $key => $value){
$wpbi_chart -> create_element($key, $value);
$wpbi_chart -> elements[$key] -> set_colour($label_color[$key]);
}
break;
case chart::BAR_HORIZONTAL: if(sizeof($label_x) > 0){
$wpbi_chart -> set_y_axis_labels($label_x,
$vo_chart->chart_y_labels_size,
$vo_chart->chart_y_labels_color);
}
$wpbi_chart-> set_x_axis_labels_color($vo_chart->chart_x_labels_color);
$wpbi_chart-> set_x_axis_labels_size($vo_chart->chart_x_labels_size);
foreach($data as $key => $value){
$wpbi_chart -> create_element($key, $value);
$wpbi_chart -> elements[$key] -> set_colour($label_color[$key]);
}
break;
default: if(sizeof($label_x) > 0){
$wpbi_chart -> set_x_axis_labels($label_x,
$vo_chart->chart_x_labels_size,
$vo_chart->chart_x_labels_color, sizeof($istime_cols) > 0);
$wpbi_chart->x_axis_istime = (sizeof($istime_cols) > 0);
echo "welcome";
} else {
$wpbi_chart->set_x_axis_labels_color($vo_chart->chart_x_labels_color);
$wpbi_chart->set_x_axis_labels_size($vo_chart->chart_x_labels_size);
}
$wpbi_chart-> set_y_axis_labels_color($vo_chart->chart_y_labels_color);
$wpbi_chart-> set_y_axis_labels_size($vo_chart->chart_y_labels_size);
foreach($data as $key => $value){
$wpbi_chart -> create_element($key, $value);
$wpbi_chart -> elements[$key] -> set_colour($label_color[$key]);
}
break;
}
Ok friend. Take easy.
You have to pay attention in some things here:
1 – That errors are showed because your error_reporting are set to E_ALL. If you set it like below, the errors will not be displayed.
But, it don’t will resolve the errors on code. Will just hide it.
2 – When you see “Invalid argument supplied for foreach()”, your code are trying to iterate over a empty variable. You need go to that file and line, and do something lile:
It will prevent the foreach to be called with invalid variables.
3 – When it says “Trying to get property of non-object”, on that line, you have a variable that are not an object. It can be a string, or a integer.. or anything else.. it just aren’t a object.
Looking all erros, you can see that data variable are empty, and then all errors happen after that, because that code are made to always run with $data. Try to check your code to guarantee that $data have the value before the switch on start.