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.
Comment | File | Size | Author |
---|---|---|---|
#18 | menu_access_callback_issue-935152-18.patch | 3.77 KB | Dean Reilly |
#19 | menu_access_callback_issue-935152-19.patch | 3.77 KB | Dean Reilly |
#5 | features.D7.935152-5.patch | 836 bytes | adamdicarlo |
#4 | features_935152.patch | 776 bytes | hadsie |
Comments
Comment #1
hefox CreditAttribution: hefox commentedSet $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).
Comment #2
timwoodhefox, 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.
Comment #3
hefox CreditAttribution: hefox commentedhttp://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.
Comment #4
hadsie CreditAttribution: hadsie commentedThe suggestion in #1 works great for me. Here's a patch against 6.x-1.0. Thanks @hefox!
Comment #5
adamdicarlo CreditAttribution: adamdicarlo commentedHere'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.
Comment #6
adamdicarlo CreditAttribution: adamdicarlo commentedAh, one note for the maintainers, the "i.e." in that patch's comment should be "e.g.".
Comment #7
dgsiegel CreditAttribution: dgsiegel commentedi can confirm that patch #4 works great on drupal 6.x
Comment #8
timwoodCan these patches be committed to the 6.x and 7.x branches so they are included in the next release of Features?
Comment #9
irakli CreditAttribution: irakli commentedCan you please explain use-case? Why would somebody need to export these system paths?
Comment #10
hefox CreditAttribution: hefox commentedIt'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.
Comment #11
irakli CreditAttribution: irakli commented@hefox, I see.
Thank you for clarifying.
Comment #12
jhedstromChanging status back to needs review, since I think hefox provided the additional information irakli requested.
Comment #13
alanmackenzie CreditAttribution: alanmackenzie commentedI can confirm that patch #4 works perfectly for features 6.x-1.1.
Comment #14
hefox CreditAttribution: hefox commentedCommited 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?
Comment #15
febbraro CreditAttribution: febbraro commentedComment #16
febbraro CreditAttribution: febbraro commentedCommitted to 7.x, thanks! http://drupalcode.org/project/features.git/commit/65e9182
Comment #17
recidive CreditAttribution: recidive commentedI 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.
Comment #18
Dean Reilly CreditAttribution: Dean Reilly commentedThere'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.
Comment #19
Dean Reilly CreditAttribution: Dean Reilly commentedOops, left a db_queryd function in. Please use this patch.
Comment #20
patricksettle CreditAttribution: patricksettle commentedCommitted http://drupalcode.org/project/features.git/commit/f471efe into 6.x-1.x
Comment #21
recidive CreditAttribution: recidive commentedHi 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.
Comment #22
recidive CreditAttribution: recidive commentedIt's still not working for me, I get login menu link exported, but it's not created when enabling the feature.
Comment #23
hefox CreditAttribution: hefox commentedThere's various other menu link bugs that could be effecting that; check some of the other issues.
Comment #24
srjoshClosing due to lack of activity.
Comment #25
Alex Bukach CreditAttribution: Alex Bukach commented@febbrarro This is the issue again for D7 (the committed fix has been reverted). Could you please reopen the issue?