Drupal: How to Rebuild Menu Navigation - drupal

In Drupal 7.0, when I change a routing path/menu from the type MENU_NORMAL_ITEM to the type MENU_CALLBACK, Drupal 7.0 does not remove the item from the menu_links table. I'm not sure if this is a bug or not, but I've filed one with the core team.
With that context in place, is there a way to force Drupal to do a rebuild of all its navigation menus? The bug I've described above is happening even when I clear out Drupal's cache after changing a Menu item.
I know I can rename an individual menu route, clear cache/refresh, and then name the item back to get any individual route/menu link flushed. I'm looking for a single command I can run (or function to call, or set of commands) and know all the menu navigation is up to date without worrying I've hosed some other part of the system by messing with internals.
Does this exist? If you're going to mention drush or devel, you're awesome, but specific instructions on those tools are what I'm after.

Note that although there are options to rebuild the menu (see the other answers), these might or might not work to clean up issues with menu links.
Rebuilding the menu just rebuilds the menu router items and the menu links as far as they are automatically generated based on the menu router items. There are known issues with that, for example re-parenting menu links (http://drupal.org/node/550254). If menu links have been customized or added manually (or Drupal thinks they have been changed.. ), then these will not be touched.
As mentioned in another question already, the tight coupling between these two systems will probably be changed in D8 so that you will have to declare menu links separatly from menu router items.

Here is another option for when you're not able to access the site or do not have Devel or Drush installed. Create a file such as rebuild.php and place it in your Drupal root (though it doesn't matter because chdir will switch to the specified Drupal root). Then after you visit that script it should rebuild the menu's and all should then be well on the site.
<?php
// Bootstrap
// Change chdir to the full path of your Drupal root
chdir('/home/myusername/public_html/');
define('DRUPAL_ROOT', getcwd());
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// Rebuild
menu_rebuild();
?>

variable_set('menu_rebuild_needed', TRUE);

I came across the same problem. I switched from MENU_NORMAL_ITEM to MENU_CALLBACK and could not get rid of the menu items in the navigation block. I tried a couple of the solutions above with no success. What worked for me was commenting out my menu items in hook_menu, clearing cache, re-enabling them and clearing cache once again.
This is what I returned in Hook_menu to clear all menu items:
return array(); //$items;

Visiting the modules list page generally rebuilds the menus.
You can also try installing Dev modules Enable the dev block and you have a link for rebuild menus.

There are many ways to do it but the best way to do it is to use the devel module.
Once you enable the module then go to blocks and enable the devel block on ur side bar.
Then refer to the red box in the image
http://cyrve.com/screenshots/devel_theme_snap-20080113-205127.jpg
It has an option for to clear the menu cache. The location of the block will depend on where you place the block.

If you have the Devel module installed, you can go to the menus configuration page (/admin/build/menu) and then select Devel menu.
Inside that page will appear a Rebuild menus options.

In D7, the menus configuration page has moved to admin/structure/menu/ .
This little trick is the great way to get the menu router to rebuild without cluttering up the UI with another block.

Related

UberMenu options screen doesn't work at menu setup

I just purchased and installed UberMenu plugin version v3.2.1.1, followed the setup exactly the way they described, and I'm able to see the Ubermenu instance in my front page, as it should be.
However, I can't access the customization area of the menu, and therefore I can't tweak it my own way.
When I go to Appearance -> Menus and click on the Uber button on any menu item, all I get is an empty options popup, just like the image below. None of the tabs present any content, it's just like the plugin scripts weren't being loaded.
However I see that blue popup in the lower right end of the screen saying it was being loaded correctly, and it's gone properly when it ends the job.
What can I do to enable/load correctly the configuration options for this plugin?
Thanks!
There are generally 2 possibilities that can make this happen:
A PHP error occurs (for example, a memory limit exception), preventing the page from loading the content critical to the menu item settings panel. You can check if that's the case by viewing your Menus Panel page source and seeing if you have a closing HTML tag.
or
The theme alters the admin menu structure via a custom Walker, resulting in the plugin not being able to find the appropriate data within the admin menu items to generate the settings panel. This is not very common, but can happen with themes that offer their own custom menu item settings within the Appearance > Menus Panel, as they alter the standard item markup to suit their needs.
If you need assistance, just Submit a Support Ticket over at sevenspark.com and we'll help you get it sorted out :)
Have a great weekend!

Fishpig Magento Extension: Homepage and sidebar widgets not working

When I add widgets to my "First Front Page Widget Area" nothing appears on my homepage.
I am using WordPress template Twenty Twelve. I created a "home" page and assigned it to be a "Front Page Template". I also customized the template to show the static page "home". I assigned the recent posts to show on homepage as a tests and nothing shows, just the page title (Home).
I tried changing my file Fishpig_Wordpress.xml (under app/etc/modules/) to Fishpig_Wordpress.xml.old, but this made WordPress inaccessible (404 error), so I changed the name back to Fishpig_Wordpress.xml.
Lastly, I tried updating the the extension to the latest version 3.0.3.8 (stable) and still the widgets are not showing.
Anybody knows what else I can do or what might be preventing my widgets from working?
Thank you!
Firstly, the app/etc/modules/Fishpig_Wordpress.xml file is the bootstrap file for this extension. This file instructs Magento where the code lives for this file. Deleting - or renaming - this file will not fix any issues but will disable the module (you may need a cache refresh for this change to be acted on).
With the latest version of the extension, widgets should work in the left or right columns of your Magento template. To ensure this, happens, enable the Twenty Twelve theme (which you have done) and ensure you are using the latest version of wordpress.xml. Check your custom theme's layout folder for wordpress.xml and rename it wordpress.xml.old, as this will force Magento to use the latest version of the file in base/default. After doing this, you will need to refresh your layout XML cache.
Next, ensure that you actually have some widgets enabled. To test this, enable a default widget like the Search widget or the Recent Posts.
The above is generic advice for people who can't get widgets to display. Your situation is slightly different as it sounds like widgets work for you, just not on your custom homepage. If this is correct, check that your custom WP page is using a template that has a sidebar column. You can do this by checking the HTML source. Alternatively, reply to this answer with your URL and I'll take a look.

Wordpress Pages Vs. Categories

I am using a wordpress theme that is placing my pages and catagories in the opposite places I want them (See Below). Is there a way I can pragmatically switch the places where the pages (about, contact, apps) with the categories? I've looked around but cant find anyone who has had a similar issue.
If the theme supports changing menu items, then #golddc's answer tells you what to do. But if the theme doesn't support it and you're not ready to develop a theme from scratch, you may be able to modify the existing theme:
Go into the Wordpress back-end and navigate to Appearance > Editor (two options below Appearance > Menu).
Find the file on the right that governs the site's header. This is probably header.php. The right file will hopefully include wp_list_pages(); and wp_list_categories(); somewhere, since these are the functions which, predictably enough, tell Wordpress to list the site's pages and categories, respectively.
Switch the locations of wp_list_pages(); and wp_list_categories(); and see if that has the desired effect.
You can check the "Menu" settings in the WP backend, which you can find at Appearance -> Menus. If the theme supports it, you can create menu items with categories.
Check here for how to use the menus:
http://codex.wordpress.org/WordPress_Menu_User_Guide
If the theme doesn't support that (although I think Menus is supported) and it's definitely needed, you may have to consider developing your own theme.

Drupal 7 admin new menu

Is it possible to implement a new admin menu in Drupal 7?
Currently I am using Seven theme.
What I want to do is adding another tab on the Content menu with just: Comment, Comment to content, Comment, Submission.
I added a new menu on the admin menu structure, but the menu is not showing anywhere.
I made page--admin--content--submission.tpl.php to start making the interface, but I can't make it according to the current selected admin theme.
Please point me somewhere since I already googled with no luck.
Update screenshot :
Did you try clearing your cache? You can do that via the Performance page, at yoursite.com/admin/config/development/performance.

Drupal 7, subpages not showing up

I have pages that I've organised to be under another main page but it isn't showing up under the secondary menu.
How do I get the secondary menu to display child pages of the current page?
Would there be a theme that does this already, i've tried zen and stark but they don't list the pages organised under the current page.
This sounds like a bug that I've run into myself: Custom menus never receive an active trail
I've explained a workaround in a duplicate issue.
To sumerize:
The problem is that Drupal core active trail, breadcrumb and menu expansion only work for a set of core menus, defined as:
$menus = variable_get(
'menu_default_active_menus',
array_keys(menu_list_system_menus())
);
There is no interface to change this, but you could do it in your settings.php and add the names of the menus you have created. Not a practically solution, but at least it works. You don't usually create new menus that often, so should be fine. An example of what to put in your settings.php file:
$conf['menu_default_active_menus'] = array(
'navigation', // Core menu
'management', // Core menu
'user-menu', // Core menu
'main-menu', // Core menu
'menu-products', // Custom menu
'menu-custom-menu', // Custom menu
);
The Menu Block module works well for displaying the kind of sub-menu you're describing. The module's administration page has lots of options though, so it can take a while to tweak it to get just what you need.

Resources