2

Site link

here, in this 9 is the user id.it is different according to register users.

When add link in main menu there is an option Path textbox in that text box if i add "user/9/edit" then link is created but here 9 is login user id. then it is accessible only whose user id 9. but other not access. I want to add link dynamic which user are login then that user access that user edit page.user/*/edit

1
  • have you tried user/*/edit in main menu Commented Oct 27, 2015 at 10:36

2 Answers 2

1

Install me aliases module.

Provides shortcut paths to current user's pages, eg user/me, blog/me, user/me/edit, tracker/me etc.

0

Menu token

Menu Token module provides tokens, that could be used in title or in path of menu items (links). For example, if you create a menu item with path: "user/[current-user:uid]", the url will be changed "on fly" to: "user/1" (assuming you are user 1).

or you can do it by using hook_menu_alter

/**
 * Implements hook_menu_alter.
 * Check access for forum menu item.
 */
function MYMODULE_menu_alter(&$items) {
  $items['forum']['access callback'] = '_accesscheck';
}
/**
 * Callback to disallow access for the anonymous user.
 */
function _accesscheck(){
  global $user;
  return $user->uid;
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.