summaryrefslogtreecommitdiff
path: root/modules/user/user.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/user/user.module')
-rw-r--r--modules/user/user.module29
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index 500875779..adfb493c1 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -1789,6 +1789,14 @@ function user_menu_site_status_alter(&$menu_site_status, $path) {
* Implements hook_menu_link_alter().
*/
function user_menu_link_alter(&$link) {
+ // The path 'user' must be accessible for anonymous users, but only visible
+ // for authenticated users. Authenticated users should see "My account", but
+ // anonymous users should not see it at all. Therefore, invoke
+ // user_translated_menu_link_alter() to conditionally hide the link.
+ if ($link['link_path'] == 'user' && $link['module'] == 'system') {
+ $link['options']['alter'] = TRUE;
+ }
+
// Force the Logout link to appear on the top-level of 'user-menu' menu by
// default (i.e., unless it has been customized).
if ($link['link_path'] == 'user/logout' && $link['module'] == 'system' && empty($link['customized'])) {
@@ -1797,6 +1805,16 @@ function user_menu_link_alter(&$link) {
}
/**
+ * Implements hook_translated_menu_link_alter().
+ */
+function user_translated_menu_link_alter(&$link) {
+ // Hide the "User account" link for anonymous users.
+ if ($link['link_path'] == 'user' && $link['module'] == 'system' && user_is_anonymous()) {
+ $link['hidden'] = 1;
+ }
+}
+
+/**
* Implements hook_admin_paths().
*/
function user_admin_paths() {
@@ -1809,6 +1827,17 @@ function user_admin_paths() {
}
/**
+ * Returns $arg or the user ID of the current user if $arg is '%' or empty.
+ *
+ * Deprecated. Use %user_uid_optional instead.
+ *
+ * @todo D8: Remove.
+ */
+function user_uid_only_optional_to_arg($arg) {
+ return user_uid_optional_to_arg($arg);
+}
+
+/**
* Load either a specified or the current user account.
*
* @param $uid