user/uid/edit is giving permission denied where uid = the current user's uid. The permissions all look correct. Is there any way to find out what exactly is denying the permission?
1 Answer
Users should always be able to edit their own profile. The access callback used for "user/%user_category/edit" is user_edit_access(), which contains the following code:
return (($GLOBALS['user']->uid == $account->uid) || user_access('administer users')) && $account->uid > 0;
When the currently logged-in user tries to edit his/her account, the function returns TRUE
, which means s/he has access to the edit form.
There could be a third-party module that altesr the access callback for that menu item, and which is using code that doesn't allow the currently logged-in user to edit his/her own account, or that doesn't consider such a case.
-
1I figured out what was causing it, but I don't understand why. Perhaps you can enlighten me. In hook_menu_alter I put this in order to hide the edit tab: $items['user/%user/edit']['type'] = MENU_CALLBACK; I didn't want that tab there, preferring to link the user to the edit page myself. Apparently this also caused permission denied.– JorenCommented Sep 15, 2011 at 18:10
-
2If you are using Drupal 6, the menu item is defined for "user/%user_category/edit" not "user/%user/edit."– avpaderno ♦Commented Sep 15, 2011 at 18:49