Download & Extend

My account (disabled)

Project:Drupal core
Version:7.x-dev
Component:menu system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:d7wtf, needs backport to D7

Issue Summary

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.

http://drupal.org/node/1092866

Comments

#1

+1

#2

Version:7.2» 7.x-dev
Status:active» needs review

The 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.

AttachmentSizeStatusTest resultOperations
1197622-user-account-link.patch555 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 34,292 pass(es).View details

#3

I 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!

#4

This is a really annoying problem, any fixes?

#5

The patch in #2 will probably fix it for you.

#6

Priority:normal» major
Status:needs review» reviewed & tested by the community

Fix 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.

#7

Status:reviewed & tested by the community» needs review

I'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:

  1. I am not sure it is a good idea to check the global directly.
  2. lyricnz's comment:

    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.

  3. The api docs for user_is_anonymous():
    <?php
    function user_is_anonymous() {
     
    // Menu administrators can see items for anonymous when administering.
     
    return !$GLOBALS['user']->uid || !empty($GLOBALS['menu_admin']);
    }
    ?>

    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.

#8

Priority:major» normal

#9

Version:7.x-dev» 8.x-dev

Also, bugfixes need to go against D8 first to prevent regressions.

#10

Issue tags:+needs backport to D7

tagging for backport.

#11

+1

#12

+1

#13

Status:needs review» needs work

"Needs work" is more appropriate, given the concerns in #7.

#14

+1

#15

Subscribe

#16

+1

#17

Why 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.

#18

A 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.

#19

+1

#20

@Martin Mayer: "+1" or "subscribe" posts are no longer necessary. Use the follow button on the top right of the page. If you want to openly express your support for this issue, please do so by reviewing and testing patches or contributing code.

#22

subscribe

#23

@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.

#24

To 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.

#25

Thanks 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.

#26

Issue tags:+Needs tests

This should be testable.

#27

Status:needs work» needs review
Issue tags:-Needs tests

yktdan should get credit on this patch.

AttachmentSizeStatusTest resultOperations
drupal-1197622-27-tests.patch1.84 KBIdleFAILED: [[SimpleTest]]: [MySQL] 37,122 pass(es), 2 fail(s), and 0 exception(s).View details
drupal-1197622-27-combined.patch2.4 KBIdlePASSED: [[SimpleTest]]: [MySQL] 37,122 pass(es).View details

#28

Isn't that identical patch that was originally posted here? (but tests are good)

#29

@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.

#30

I wasn't fishing for credits :) I was asking if xjm's concerns had been suitably addressed?

#31

Haha 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.

#32

Agree 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

AttachmentSizeStatusTest resultOperations
drupal-1197622-32-combined.patch3.55 KBIdlePASSED: [[SimpleTest]]: [MySQL] 37,120 pass(es).View details

#33

Arguably, that UI change could be a separate patch. Happy to RTBC the functional change, and submit the UI change as a new issue.

#34

#32 should be a follow-up, #27 should be RTBC.

#35

#36

Agreed 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.

#37

Status:needs review» reviewed & tested by the community

There was already #327230: user_is_anonymous() is ugly. Great title.

#38

Status:reviewed & tested by the community» needs review

Updated for #1380958: Replace $modules list for WebTestBase::setUp() with ::$modules class properties (plus a cleanup for the class docblock).

AttachmentSizeStatusTest resultOperations
menu-1197622-38-test-only.patch2.66 KBIdlePASSED: [[SimpleTest]]: [MySQL] 39,876 pass(es).View details
menu-1197622-38.patch3.82 KBIdlePASSED: [[SimpleTest]]: [MySQL] 39,868 pass(es).View details
interdiff.txt1.1 KBIgnored: Check issue status.NoneNone

#39

Botched the test-only patch.

AttachmentSizeStatusTest resultOperations
menu-1197622-39-test-only.patch2.07 KBIdleFAILED: [[SimpleTest]]: [MySQL] 39,870 pass(es), 2 fail(s), and 0 exception(s).View details
menu-1197622-39.patch3.82 KBIdlePASSED: [[SimpleTest]]: [MySQL] 39,873 pass(es).View details

#40

Version:8.x-dev» 7.15

It's incredible that this bug is still there after 7.15 update!

#41

Version:7.15» 8.x-dev
Status:needs review» reviewed & tested by the community

It would be more incredible had it not been there, since this hasn't been committed yet.

Interdiff looks good.

#42

Version:8.x-dev» 7.x-dev
Status:reviewed & tested by the community» patch (to be ported)

Looks like a solid bug fix, and includes tests. Thanks!

Committed and pushed to 8.x, marking for 7.x backport.

#43

Status:patch (to be ported)» needs review

Here'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">.

AttachmentSizeStatusTest resultOperations
1197622-43-tests.patch1.98 KBIdleFAILED: [[SimpleTest]]: [MySQL] 39,392 pass(es), 2 fail(s), and 0 exception(s).View details
1197622-43.patch3.65 KBIdlePASSED: [[SimpleTest]]: [MySQL] 39,431 pass(es).View details

#44

#43: 1197622-43.patch queued for re-testing.

#45

Status:needs review» reviewed & tested by the community

Works great. Let's put this WTF to bed.

#46

Status:reviewed & tested by the community» fixed

Seems to match the 8.x patch. :)

Committed and pushed to 7.x. Thanks!

#47

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.