Restrict access to edit page for specific user I have 2 accounts where I need to prohibit them from editing the profile. I managed to hide the edit button but when I type edit into the URL it still allows them to edit the user profile.

if ($user-&gt;uid == 267 OR $user-&gt;uid == 268){
} // demo profiles, prohibit editing profile
else{
print l(t('Edit My Profile'), "user/{$GLOBALS['user']-&gt;uid}/edit");
}


I can't do this based on their role. Thanks
Looks like you're looking for Edit own user account permission.

This module add 'edit own user account' permission.
The goal of this module to prevent changes in user account information in the demo sites.

Or to do it in code:
function mymodule_menu_alter(&amp;$items) {
  if (isset($items['user/%user/edit'])) {
    $items['user/%user/edit']['access callback'] = 'mymodule_user_edit_access';
  }
}

function mymodule_user_edit_access($user) {
  if ($user-&gt;uid == 267 || $user-&gt;uid == 268) {
    return FALSE;
  }
  else {
     return TRUE;
  }
}