WordPress.org

Ready to get started?Download WordPress

Forums

menu-header.php prevents maybe the loading of the firestats page (3 posts)

  1. ntm
    Member
    Posted 5 years ago #

    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)?

  2. kelly1234
    Member
    Posted 5 years ago #

    my problem with the automatic upgrade from 2.6.1 to 2.6.2 is in the headmeta, I get these two errors at the top of the page,

    Warning: Invalid argument supplied for foreach() in /home/mypeople/public_html/wp-content/plugins/headmeta/headmeta.php on line 59

    Warning: Invalid argument supplied for foreach() in /home/mypeople/public_html/wp-content/plugins/headmeta/headmeta.php on line 66

    As I am not a computer programmer, can anyone help in simple terms?

    I hate to back up to before the upgrade and lose my posts.

  3. ntm
    Member
    Posted 5 years ago #

    @kelly1234:
    The errors you are describing are related to the plugin "headmeta" maybe it is the best to look for a new version of this plugin or post this problem description in the category "Plugins and Hacks" of this forum as a new thread.

Topic Closed

This topic has been closed to new replies.

About this Topic