I believe I've just discovered a bug in features that prevents non-anonymous users (those you'd probably have building features) from including certain menu items from being exported due to the default access callback for these items. Specifically user/login and user/password are menu paths that cannot be exported via Features when you have sensible permissions configured for your site. This is due to the fact that in the menu_router table they have an access_callback of "user_is_anonymous". Features should somehow safely ignore/override this access check so these menu items can be exported.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hefox’s picture

Set $GLOBALS['menu_admin'] = TRUE when wanting to include items with that access callback in something.

I believe needs to be added in menu_links_features_export_options before menu_parent_options call.

(Likely a ui/options only bug, as I've used user/register before by directly adding it to the .info file).

timwood’s picture

hefox, I was going to do what you suggested, adding it directly to the .info file after I exported the rest of the settings I wanted. Lets hope the Features team can fix the UI bug.

hefox’s picture

http://drupal.org/patch/create; You could also try patching and testing it yourself; if what I said above is correct, it should just be a one line patch.

hadsie’s picture

Status: Active » Needs review
FileSize
776 bytes

The suggestion in #1 works great for me. Here's a patch against 6.x-1.0. Thanks @hefox!

adamdicarlo’s picture

Version: 6.x-1.0 » 7.x-1.0-beta1
FileSize
836 bytes

Here's that patch rolled against 7.x-1.0-beta1. Works great for me.

Another bug this fixes: Recreating a feature where you'd *manually* added (e.g.) user/login menu link would remove it from the feature's .info file.

adamdicarlo’s picture

Ah, one note for the maintainers, the "i.e." in that patch's comment should be "e.g.".

dgsiegel’s picture

i can confirm that patch #4 works great on drupal 6.x

timwood’s picture

Status: Needs review » Reviewed & tested by the community

Can these patches be committed to the 6.x and 7.x branches so they are included in the next release of Features?

irakli’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

Can you please explain use-case? Why would somebody need to export these system paths?

hefox’s picture

It's fairly common to have a login link in a main or footer menu (the majority of my more basic sites have them as a quickie way to get a login link somewhere). When making a feature like blog, forum, etc, a login link would be unlikely, but for a feature that is basically used for deploying, ie. general site configuration, this would be more common.

irakli’s picture

@hefox, I see.

Thank you for clarifying.

jhedstrom’s picture

Status: Postponed (maintainer needs more info) » Needs review

Changing status back to needs review, since I think hefox provided the additional information irakli requested.

alanmackenzie’s picture

I can confirm that patch #4 works perfectly for features 6.x-1.1.

hefox’s picture

Commited to 6.x branch http://drupalcode.org/project/features.git/commit/37ce314

Needs to be commited to 7.x branch also; has that one been reviewed enough?

febbraro’s picture

Assigned: Unassigned » febbraro
febbraro’s picture

Status: Needs review » Fixed
recidive’s picture

Status: Fixed » Needs work

I tested the patch in #5 and it makes the menu items show up in features ui and are exported fine. Can't make them import though, even after reverting menu links components.

Dean Reilly’s picture

There's an issue with this patch that if menu_parent_options() is called before features calls it without $menu_admin being set to true menu_tree_all_data() returns a statically cached version of the menu which will still be missing these links.

The way menu.admin.inc gets around this for the menu overview page is to basically copy the body of the function. Attached is a patch which does this for features 6.x.

This code was developed for Fujitsu by BrightLemon Ltd. Thanks go to both for allowing me to release it.

Dean Reilly’s picture

Version: 7.x-1.0-beta1 » 6.x-1.1
FileSize
3.77 KB

Oops, left a db_queryd function in. Please use this patch.

patricksettle’s picture

Status: Needs work » Closed (fixed)
recidive’s picture

Hi guys, are you sure this is working in 7.x? I get e.g. user/login menu item exported but it doesn't get created, at least when enabling the feature through an install profile.

recidive’s picture

Version: 6.x-1.1 » 7.x-1.x-dev
Status: Closed (fixed) » Needs work

It's still not working for me, I get login menu link exported, but it's not created when enabling the feature.

hefox’s picture

There's various other menu link bugs that could be effecting that; check some of the other issues.

srjosh’s picture

Issue summary: View changes
Status: Needs work » Closed (fixed)

Closing due to lack of activity.

Alex Bukach’s picture

@febbrarro This is the issue again for D7 (the committed fix has been reverted). Could you please reopen the issue?