Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
In D7, whenever I go into Administration » Structure » Menus
The menu item for My account always shows "My account (disabled)"Tried clicking the "ENABLED" check box and save, it will say changes saved but the check box will revert to being unchecked.
Why is it always disabled? Although the My account menu item does still appear under the user menu block when viewed in front end.
Thanks.
This has been going on since March 15, 2011 and it still appears in latest release of Drupal. I was unable to find another issue queue with this issue.
Comment | File | Size | Author |
---|---|---|---|
#43 | 1197622-43-tests.patch | 1.98 KB | star-szr |
#43 | 1197622-43.patch | 3.65 KB | star-szr |
#39 | menu-1197622-39-test-only.patch | 2.07 KB | xjm |
#39 | menu-1197622-39.patch | 3.82 KB | xjm |
#38 | menu-1197622-38-test-only.patch | 2.66 KB | xjm |
Comments
Comment #2
lyricnz CreditAttribution: lyricnz commentedThe bug is not that saving it has no effect, but that it is not shown in the correct state.
During construction of the form, user.module modifies the "User/My account" link to be hidden for anonymous users AND when administrators editing the menu - by calling the suspiciously named user_is_anonymous(). In this case, it should be checking for real anonymous users only.
Here's a patch that checks for anonymous users directly. My only reservation is that drupal_valid_path() also calls _menu_link_translate() which ends up calling the same code - so this change could impact there.
Comment #3
Adam Wood CreditAttribution: Adam Wood commentedI had the same problem.
The 'My Account' link was working originally, then after building other user menu items (login/register) it disappeared.
After not being able to figure it out, I just tried hitting 'Reset' to the right of the menu item and it re-appeared!
Definitely buggy... Every time I mess with that menu it disappears again!
Hope this helps others, for now...
EDIT: I've figured out that it's when I move the 'My Account' link up or down that it gets rid of it and when I reset it, it sits under 'Log Out', which is annoying, as I want it above it!
Comment #4
chrislabeard CreditAttribution: chrislabeard commentedThis is a really annoying problem, any fixes?
Comment #5
lyricnz CreditAttribution: lyricnz commentedThe patch in #2 will probably fix it for you.
Comment #6
marcvangendFix in #2 works as advertised.
I'm raising the priority to major - the patch may be tiny, but the problem it solves is a huge WTF for site administrators.
Comment #7
xjmI'm not sure this actually qualifies as major (confusing though it may be); it does not have "significant repercussions."
I think this is still NR for three reasons:
The comment explicitly states that it's supposed to make menu items for anonymous visible to administrators. This is questionable to say the least, as @lyricnz points out.
I am wondering if we should not perhaps target the "my account" link specifically, rather than making a broad change. Maybe the whole pattern should get re-thunk for D8 and we can backport some small, specific fix to alleviate the confusion in D7.
Edit: reorganized comment for readability.
Comment #8
xjmComment #9
xjmAlso, bugfixes need to go against D8 first to prevent regressions.
Comment #10
catchtagging for backport.
Comment #13
marcvangend"Needs work" is more appropriate, given the concerns in #7.
Comment #17
infines CreditAttribution: infines commentedWhy target 1 link specifically instead of just solving the issue by either the above patch or going back to the drawing board on how drupal handles links like these. This issue has been reported happening with other modules, too, so a new way for drupal to look at links like this would be the best path, imo.
Comment #18
infines CreditAttribution: infines commentedA solution could be to use the above patch, and then add another column to the menu administration table that has role viewing/use permissions listed.
Comment #21
clemens.tolboom[Stock response from Dreditor templates and macros.]
This is similar to:
#308263: Allow privileged users to bypass the validation of menu items
#1337546: Cannot reorder 'User Menu' items for user/register user/login as these are not accessible by admin
Comment #22
my-family CreditAttribution: my-family commentedsubscribe
Comment #23
xjm@my-family: You don't need to post "subscribe" comments any more. There is a green "Follow" button in the upper right corner of issues that you can use instead.
Comment #24
star-szrTo work around this without patching, you can try creating a custom "My account" menu item pointing to
user
and use Menu item visibility to only show the menu item to authenticated users. Worked for me.Comment #25
one_orange_cat CreditAttribution: one_orange_cat commentedThanks for this @Cottser - worked great for me and I've reposted your workaround on the related forum page.
I do think this (and others around "My account") are very visible and confusing little bugs though, unfortunately present right out of the box in D7; if possible we could really do with a quick patch-up there.
Comment #26
xjmThis should be testable.
Comment #27
tim.plunkettyktdan should get credit on this patch.
Comment #28
lyricnz CreditAttribution: lyricnz commentedIsn't that identical patch that was originally posted here? (but tests are good)
Comment #29
tim.plunkett@lyricnz, yes, yktdan and I just worked on the tests together at NYC Camp. It was definitely your patch. I just meant that he should ALSO get credit, even though I uploaded the file.
Comment #30
lyricnz CreditAttribution: lyricnz commentedI wasn't fishing for credits :) I was asking if xjm's concerns had been suitably addressed?
Comment #31
tim.plunkettHaha sorry I misunderstood.
I don't think there's anything particularly wrong with using a global like that, and I think fixing user_is_anonymous is a bit out of scope for this very clearly reproducible bug.
Comment #32
lyricnz CreditAttribution: lyricnz commentedAgree that changing user_is_anonymous() is a bit risky, so our original proposal is OK. Even the existing comment in user_translated_menu_link_alter() describes the correct behaviour 'Hide the "User account" link for anonymous users'!
Do you think it's worth describing this special case in the UI? (adding 'logged in users only' next to the /user link)?
PS: There's an unused variable $title in _menu_overview_tree_form() - but I've left it intact to minimize the patch
Comment #33
lyricnz CreditAttribution: lyricnz commentedArguably, that UI change could be a separate patch. Happy to RTBC the functional change, and submit the UI change as a new issue.
Comment #34
tim.plunkett#32 should be a follow-up, #27 should be RTBC.
Comment #35
lyricnz CreditAttribution: lyricnz commentedAgree - created #1698586: Show a message about "My Account" menu link not being shown to anonymous users
Comment #36
xjmAgreed about splititng off #32. Can we also get a followup for the
user_is_anonymous()
weirdness? I'd be okay with this being RTBC if we have a followup for that linked here.Comment #37
tim.plunkettThere was already #327230: user_is_anonymous() is ugly. Great title.
Comment #38
xjmUpdated for #1380958: Replace $modules list for WebTestBase::setUp() with ::$modules class properties (plus a cleanup for the class docblock).
Comment #39
xjmBotched the test-only patch.
Comment #40
warmth CreditAttribution: warmth commentedIt's incredible that this bug is still there after 7.15 update!
Comment #41
tim.plunkettIt would be more incredible had it not been there, since this hasn't been committed yet.
Interdiff looks good.
Comment #42
webchickLooks like a solid bug fix, and includes tests. Thanks!
Committed and pushed to 8.x, marking for 7.x backport.
Comment #43
star-szrHere's a backport for D7.
The only thing to note: the test was updated to look for
<ul id="secondary-menu-links">
instead of<ul id="secondary-menu">
.Comment #44
droplet CreditAttribution: droplet commented#43: 1197622-43.patch queued for re-testing.
Comment #45
lyricnz CreditAttribution: lyricnz commentedWorks great. Let's put this WTF to bed.
Comment #46
webchickSeems to match the 8.x patch. :)
Committed and pushed to 7.x. Thanks!
Comment #48
marissamClosed issue #1698586: Show a message about "My Account" menu link not being shown to anonymous users as duplicate of this one.
Comment #49
warmth CreditAttribution: warmth commentedAre you totally sure those are the same issue?
Comment #50
gpvdo CreditAttribution: gpvdo commentedI am testing out Drupal 7.27 for a project and have a simple issue I am not able to figure out after hours of net searching.
1. I have added my own custom menu at the top with the menu items
"Home" (path=), "Login" (path=user/login), "Register" (path=user/register), "My Account" (path=user)
and "Logout" (path=user/logout).
2. The Login/Register/Logout links work perfectly - when a user is logged in, only the "My account" and "Logout" links
are displayed, like they should be.
3. But when a user is anonymous, it displays "My account" in addition to "Login" and "Register". Why is it doing that?
4. This thread is the closest I came to with respect to this issue. Is there any way to make the "My account" not display
when a user is not logged in?
5. Note: I can move the existing link from 'User menu' to my menu and that fixes the problem.. but I'd rather not move it.
6. Related question is: In the User menu, why are only two links - 'My Account' and 'Logout' displayed instead of the four
I am expecting?
7. If this is a bug (looks like it to me), is there a patch or workaround available to fix this?
I would appreciate any help. So far I am liking Drupal a lot, but have not wandered in too deep yet..
Comment #51
gpvdo CreditAttribution: gpvdo commentedI worked around the issue by simply using the built-in User-menu to begin with (rather than my own menu) and adding 'Login' and 'Create Account' links to it.
It would be nice to have both a
- 'My account' (for logged in users only), plus
- 'My account' (for all users)
that users can add to menus.