menu-header.php prevents maybe the loading of the firestats page
-
The firestats(a plugin) page was not loading since i had updated some of the plugins i’m using, too. Further after clicking on the firestats page link in the submenu of the dashboard: Only the anthracite and the light blue colored stripes showed up only with the dash menu links but without any admin menu link and without the rest of the page content and footer.
Further i have observed that after i deactivate one of these other plugins the problem with the firestats page disappears and the page appears.
I could not reproduce this behaviour by deactivating one arbitrary plugin.
Because i would miss the most of the plugins which let the firestats page appear again by thier deactivation i have tried to find the source of the problem.This problem was observed by at least one other person, too: wordpress-26-and-firestats
I found out that the page loads until in admin-header.php the menu-header.php is required
require(ABSPATH . 'wp-admin/menu-header.php');
Furthermore i looked into menu-header.php and found out that putting the second foreach loop of the admin menu creation part into a comment solved the problem, too.
But disabling some code is not the solution.
So merging these two foreach loops of this section is probably a better idea.
This should do the same as the two loops:foreach ( $menu as $key => $item ) { if ( ($key >= 5 && $key < 25) || ($key > 40) ) { $class = ''; // 0 = name, 1 = capability, 2 = file if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"'; if ( !empty($submenu[$item[2]]) ) { $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index. $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]); if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook)) { echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>"; } else { echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>"; } } else if ( current_user_can($item[1]) ) { $menu_hook = get_plugin_page_hook($item[2], 'admin.php'); if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) ) { echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>"; } else { echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>"; } } } }
What did you think a about this? Is this ok? Is this worthy a ticket at Trac (and maybe an improvement for 2.6.2)?
- The topic ‘menu-header.php prevents maybe the loading of the firestats page’ is closed to new replies.