The menu item at the path user/%user_uid_optional used to be titled 'My account' if it linked to your own profile, but a recent change now renders it as simply USERNAME by the page title callback, user_page_title(). The user edit page also has the title USERNAME (should be "My account -> "Edit").
I propose we change it back to 'My account'; it would seem to make more sense to the average user. Also, since it was changed in an unrelated issue (see #564632: Cruft in $page due to node_build, comment_build, etc.) I think it at least deserves a discussion.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | user-my-account.3.patch | 2.43 KB | carlos8f |
| #4 | view-tab.png | 16.06 KB | carlos8f |
| #4 | edit-tab.png | 20.02 KB | carlos8f |
| #4 | user-my-account2.patch | 2.67 KB | carlos8f |
| #2 | user-my-account.patch | 1.09 KB | carlos8f |
Comments
Comment #1
carlos8f commentedComment #2
carlos8f commentedCurious how many failures this will cause. This patch also fixes the menu item for user/uid to not point to user.pages.inc anymore, because user_view() was replaced by user_build() in user.module.
Comment #4
carlos8f commentedI think this is a better direction: Here I'm re-introducing the user_view() function in user.pages.inc, for the purpose of putting back the drupal_set_title() there to override the page title (from 'My account' to USERNAME). Screenshots attached. Here the Edit tab is titled My account -> Edit, instead of USERNAME -> USERNAME. Also, had to do one little tweak to openid.test.
Comment #5
carlos8f commentedComment #6
sunThis patch needs to take #635378: Wrong local task titles for taxonomy term and user account pages into account
Comment #7
carlos8f commentedThanks sun. The only local task in question here is
user/%user/edit, in which I removed the title callback anyway. I applied both patches and there's no conflict as far as I can tell.Comment #8
brianV commentedInstead of accessing the $GLOBALS array directly, we should stick with the regular core convention of using the global keyword:
Also, there is an extra line at the end of the patch.
I'm on crack. Are you, too?
Comment #9
sunI don't see one. You probably rather found a bug in Dreditor ;)
Comment #10
brianV commented@sun: You are right - looking directly at the patch file, there is no extra line at the end.
Who wrote this dreditor hunk of junk anyways? :p Look for an issue in your queue.
@carlos: Ignore my comment about the extra line.
Comment #11
carlos8f commented@brianV: not using $GLOBALS directly is a core convention? :) I count 40+ cases in HEAD that do this. This would require its own issue if we're going to make it a convention.
Comment #12
carlos8f commentedPostponing this until there is a consensus on #635378: Wrong local task titles for taxonomy term and user account pages. The patch in #2 overlaps with mine.
Comment #13
gábor hojtsyThis bug has a Drupal 6 counterpart at #480484: User page title always set to username which is now marked postponed on this one to avoid introducing a regression. Let's work down this postpone chain!
Comment #14
carlos8f commented#635378: Wrong local task titles for taxonomy term and user account pages fixed the Edit local task, so I'm removing that from the patch. To summarize, the current patch:
user/uidpages.user/my_uid/local-task, 'My account', to be visible when you're editing your own account, or other tasks related to your account.Comment #15
joetsuihk commentedwork as described in #14 point 2,3 (i do not know what pt1 is talking about..)
but in patch, why introduce a new user_view()? just add the line to user_build() should be ok i think.
Also, $GLOBALS? not global $user anymore?
Comment #16
carlos8f commentedPoint 1 in #14 means that what used to be the 'My account' link (in Garland, it's in the upper right) shows up as 'USERNAME' instead in HEAD, because of a regression from the issue I mentioned.
The reason why I'm not doing drupal_set_title() in user_build() is that *_build() functions are intended to just return a renderable array, which is generic and not limited to one specific menu item. drupal_set_title() should only be done in a proper menu callback, which I brought back for this purpose.
Using $GLOBALS wasn't my code, I was merely reverting user_page_title() to what it used to be. HEAD uses $GLOBALS in situations where a function only has to access it once or twice. Seems fine to me.
Comment #18
carlos8f commentedNote that we're dealing with the 'My account' link in another patch also, #638070: Router loaders causing a lot of database hits for access checks. I'm postponing this one since I've incorporated a better fix in that issue, which doesn't involve re-introducing user_view().
Comment #19
carlos8f commentedI created #670296: Allow menu callbacks to implement logic specific to menu links, local tasks, etc. which should solve this issue without using workarounds.
Comment #20
carlos8f commentedUnfortunately that issue got postponed to D8. Instead of doing drupal_set_title() workarounds, I'd like to pursue #408142: Create a 'user links' menu + page template variable to fix the My account link since it's not supposed to be in the secondary menu anyway.
Comment #21
carlos8f commentedAlso, for performance reasons the 'My account' link shouldn't be a menu link. See http://drupal.org/node/638070, benchmarks indicate an unnecessary user_load() for this link is causing 6-8% of authenticated page load time.
Comment #22
David_Rothstein commentedReopening (based on discussion that happened at #410646: "Secondary menu" exists but is no longer the default source for the secondary links).
The change to displaying the username was intentional, as far as I know, and perfectly good for some uses cases. However, the previous D6 behavior (where you could display the user menu as a block e.g. in the sidebar and have the menu title be your username and the link to your profile say "My account") is also a perfectly legitimate way to display user links, and we seem to have lost that in D7?
Ideally, we find a way to enable both.
Comment #23
sun#925778: User edit title is broken (so is beta1-beta2 upgrade path) contains a proper fix for the "My account" link, and a detailed summary of what is wrong in HEAD. I suspect that this issue can be marked as duplicate, though aforementioned issue does not really deal with the link title (though that could be merged into the patch).
Comment #24
carlos8f commentedMarking duplicate on #925778: User edit title is broken (so is beta1-beta2 upgrade path), let's deal with it there.